Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7418128

Browse files
committed
Rework the contribution guide and style guide.
* The docs/Asterisk-Community/Wiki-Organization-and-Style-Guide.md file has been deleted. * A new file docs/Contributing-to-the-Documentation.md has been added that contains extensive instructions/guidelines for content creation and building and testing the website locally. * The README.md file now just contains a link to the new page on the live website. * The Makefile was tweaked to be a bit friendlier. * requirements.txt was updated to the latest versions of the python packages. * mkdocs.yml was updated to enable Mermaid diagrams
1 parent b012d15 commit 7418128

File tree

7 files changed

+650
-395
lines changed

7 files changed

+650
-395
lines changed

Makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# NOTE: For readability, two space characters are used to
33
# indent the contents of make ifeq/ifneq statements.
4-
# Don;y confuse these with tabs used to indent rule
4+
# Don't confuse these with tabs used to indent rule
55
# recipies.
66
#
77

@@ -10,10 +10,17 @@ DEPLOY_BRANCH ?= gh-pages
1010
BUILD_DIR ?= ./temp
1111
GH=gh
1212
JOB_DATE ?= $(shell date +%F)
13+
SERVE_OPTS ?= -a [::]:8000
14+
BRANCHES ?=
15+
BRANCH ?=
1316

14-
include Makefile.inc
15-
ifneq ($(BRANCH),)
16-
-include Makefile.$(BRANCH).inc
17+
-include Makefile.inc
18+
19+
ifneq ($(BRANCHES),)
20+
COMMA := ,
21+
BB := $(subst $(COMMA), ,$(BRANCHES))
22+
includes := $(foreach b,$(BB),Makefile.$(b).inc)
23+
-include $(includes)
1724
endif
1825

1926
# 'make' has a realpath function but it only works on

README.md

Lines changed: 3 additions & 223 deletions
Original file line numberDiff line numberDiff line change
@@ -1,228 +1,8 @@
11
# Description
22

3-
This repository contains the Asterisk Documentation project.
3+
This repository contains the documentation for the [Asterisk](https://github.com/asterisk/asterisk) project.
44

5-
# Recent Changes
5+
## Recent Changes
66

7-
The packages used to create the documentation were upgraded on February 2 2024. While there are no breaking changes, some new capabilities were added that, if used going forward, won't render correctly with the older versions. So, if you build documentation locally, you should delete your local virtualenv and re-create it using the new requirements.txt file. The new features will be documented separately.
7+
The instructions formerly in this page for contributing to this repository have moved to the [Contributing to the Documentation](https://docs.asterisk.org/Contributing-to-the-Documentation) page on the live website.
88

9-
# Static Documentation
10-
11-
The static documentation contained in the ./docs/ directory is written directly in markdown. The publish process uses [mkdocs](https://www.mkdocs.org) and [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) to generate the HTML web site. The directory structure is fairly straightforward so if you wish to contribute, you should fork this repository and submit pull requests against files in that directory.
12-
13-
All contributions are subject to the
14-
[Creative Commons Attribution-ShareAlike 3.0 United States](LICENSE.md) license.
15-
16-
## Markdown Flavor
17-
The docs are written in standard markdown, not GitHub Flavored markdown. There are lots of extensions available though. Most of the extensions provided by [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/reference/) are enabled except those only available to paying sponsors and a few that don't make sense in this environment.
18-
19-
> [!NOTE]
20-
> The conversion process that moved the documentation from the Confluence Wiki used equals signs `=====` and dashes `----` to denote headers. The new infrastructure renders those correctly but they do not get added to the page's table of contents. Going forward, you should always use hash signs `#`, `##`, `###`, etc to denote headers.
21-
22-
### PyMdown Extensions
23-
24-
Many extensions from the [PyMdown](https://facelessuser.github.io/pymdown-extensions/) plugin are also available. The `admonition` extension is particularly useful as a replacement for the legacy `!!! note` admonition style because it uses a trailer to mark the end of the admonition instead of just a blank line. This allows you to add things like code blocks and quotes inside admonitions.
25-
26-
Admonition Example:
27-
28-
```
29-
/// warning | Don't Do This
30-
Don't do this in your code!!!
31-
'''
32-
free(NULL);
33-
'''
34-
///
35-
```
36-
37-
You couldn't do that with the legacy `!!!` style admonition.
38-
39-
If you decide to use any of the extensions from this plugin (and you should use them where possible), don't use the legacy version in the same page. For instance, don't mix `///` admonitions with `!!!` admonitions in the same page. There's a good chance they won't render correctly.
40-
41-
At some point, we'll try and convert all of the existing legacy admonitions to the new style.
42-
43-
[PyMdown Documentation](https://facelessuser.github.io/pymdown-extensions/extensions/arithmatex/)
44-
45-
Enabled extensions:
46-
47-
```
48-
betterem
49-
blocks.admonition
50-
blocks.definition
51-
caret
52-
critic
53-
details
54-
emoji
55-
highlight
56-
inlinehilite
57-
keys
58-
mark
59-
saneheaders
60-
smartsymbols
61-
snippets
62-
superfences
63-
tabbed
64-
tilde
65-
```
66-
67-
See `markdown_extensions` in the [mkdocs.yml](mkdocs.yml) file for the current list.
68-
69-
# Dynamic Documentation
70-
71-
The dynamic documentation includes the pages generated from Asterisk itself and includes:
72-
* AGI_Commands
73-
* AMI_Actions
74-
* AMI_Events
75-
* Asterisk_REST_Interface
76-
* Dialplan_Applications
77-
* Dialplan_Functions
78-
* Module_Configuration
79-
80-
The publish process gets this information directly from the Asterisk CreateDocs job (which runs nightly) and generates markdown. For this reason, all changes to the dynamic documentation need to be made in the Asterisk source code itself.
81-
82-
The AGI, AMI, Dialplan and Module documentation comes from the documentation embedded in the provider modules and generated by CreateDocs running `xmldoc dump` from the Asterisk CLI. You can also use a core-en_US.xml or full-en_US.xml file generated from a local asterisk build. See below for more information.
83-
84-
The Asterisk_REST_Interface documentation comes from the markdown files generated by CreateDocs running `make ari-stubs`. You can also use locally generated markdown files. See below for more information.
85-
86-
# Build/Test Dependencies
87-
88-
Dependencies for documentation can be installed using the included requirements.txt file.
89-
90-
```
91-
$ pip3 install -r requirements.txt
92-
```
93-
94-
If you don't want to install the requirements for the current user or globally, you can create a virtual environment specific to this directory first...
95-
96-
```
97-
$ python -m venv ./.venv
98-
$ source .venv/bin/activate
99-
(.venv)$ pip3 install -r requirements.txt
100-
# run `deactivate` when done
101-
(.venv)$ deactivate
102-
$
103-
```
104-
105-
The next time you want to test, you can just activate the virtual environment without needing to install the dependencies again. The `.venv` directory is already in the `.gitignore` file.
106-
107-
You'll also need the [`gh`](https://cli.github.com) tool to pull down the dynamic documentation from the CreateDocs job.
108-
109-
> [!NOTE]
110-
> The documentation build process no longer uses the `mike` python package.
111-
112-
# Building and Testing the Documentation
113-
114-
## Prepare
115-
116-
Everything is done from the [`documentation`](https://github.com/asterisk/documentation) repository so, if you haven't already, clone it and check out the `main` branch.
117-
118-
```
119-
$ git clone -b main https://github.com/asterisk/documentation
120-
$ cd documentation
121-
```
122-
123-
Create a `Makefile.inc` file with some configuration variables. This file must **not** be checked in. Here are the contents to use:
124-
125-
```
126-
# BUILD_DIR := <somepath> # Defaults to ./temp
127-
128-
# MkDocs needs to know the base URL for the documentation site
129-
# to properly handle links and navigation.
130-
# If you're going to deploy the site locally, use the
131-
# URL of your local server.
132-
# The default is https://docs.asterisk.org which is
133-
# probably not what you want.
134-
# NOTE: You MUST use the export keyword for this variable.
135-
# export SITE_URL := <your_local_server>
136-
137-
# The following 2 DEPLOY_ variables are only needed if you
138-
# need to deploy the built site to some other repo.
139-
# The nightly job uses this to publish the site to
140-
# GitHub pages.
141-
# DEPLOY_REMOTE := <git_remote>
142-
# DEPLOY_BRANCH := <gh pages branch> # Defaults to gh-pages
143-
144-
# The comma-separated list of branches for which dynamic
145-
# documentation should be built when doing a `make` without
146-
# specifying BRANCH=<branch>.
147-
# BRANCHES := 20,21,22
148-
149-
# If you don't want to build the static documentation at all...
150-
# NO_STATIC=yes
151-
152-
# If you don't want the resulting HTML minified, set NO_MINIFY.
153-
# Minification can reduce the space required to host the full
154-
# site by about 30% but it does take over double the time to
155-
# generate the site.
156-
# NO_MINIFY=yes
157-
158-
# If you want to serve the resulting site with mkdocs serve,
159-
# you can specify any additional options to pass to it here:
160-
# SERVE_OPTS := -a [::]:8000
161-
```
162-
163-
If you're planning on using local sources for the dynamic Asterisk documentation, you'll *also* need to create a `Makefile.<branch>.inc` file *for each branch*.
164-
165-
```
166-
# If you want to use a local XML file to generate the
167-
# AGI, AMI, Dialplan and Module_Configuration documentation,
168-
# specify it here.
169-
# ASTERISK_XML_FILE := <somepath>/asterisk/doc/core-en_US.xml
170-
#
171-
# If you want to use local markdown files for the ARI
172-
# documentation, specify a path to a directory containing
173-
# the markdown generated by "make ari-stubs".
174-
# ASTERISK_ARI_DIR := <somepath>/asterisk/doc/rest-api
175-
#
176-
# If you want to use local XML but skip processing ARI
177-
# altogether, set this variable to "yes".
178-
# SKIP_ARI := yes
179-
180-
# If either ASTERISK_XML_FILE or ASTERISK_ARI_DIR are not set,
181-
# that documentation source will be downloaded from the
182-
# CreateDocs job.
183-
```
184-
185-
## Build and Deploy
186-
187-
### To build the entire site:
188-
189-
```
190-
$ make
191-
```
192-
193-
This will build the static pages and the dynamic pages for all branches listed in the `BRANCHES` variable. The fully functioning site will be created at `$(BUILD_DIR)/site`. You can serve that directory with `make serve`, which runs `mkdocs serve` or a web server of your own choosing. `mkdocs serve` rebuilds the entire site when it starts so you may want to use a standard web server if you plan on doing this a lot. If you do use `make serve`, you can use the `SERVE_OPTS` variable in Makefile.inc to add additional options to the `mkdocs serve` command line.
194-
195-
### To build just the static pages
196-
197-
```
198-
$ make BRANCHES=
199-
```
200-
201-
### To build just 2 branches
202-
203-
Building branches does need at least a skeleton static layout so `static-setup` will be built first if it hasn't already been built.
204-
205-
```
206-
$ make BRANCHES=18,20
207-
```
208-
209-
If you only want the skeleton static documentation, you can add `NO_STATIC=yes` to that command line...
210-
211-
```
212-
$ make BRANCHES=18,20 NO_STATIC=yes
213-
```
214-
215-
### To build just 1 branch
216-
217-
If you're always going to build just 1 branch's dynamic documentation, you can skip the `Makefile.<branch>.inc` file and just place everything in the main `Makefile.inc`:
218-
219-
Makefile.inc:
220-
221-
```
222-
ASTERISK_XML_FILE := <path>/core-en_US.xml
223-
ASTERISK_ARI_DIR := <path>/rest-api
224-
BRANCHES := 20
225-
NO_STATIC := yes
226-
```
227-
228-
And just run `make`.

docs/.pages

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ nav:
1919
- Certified-Asterisk_20.7_Documentation
2020
- Test-Suite-Documentation
2121
- Historical-Documentation
22-
22+
- Contributing-to-the-Documentation.md

0 commit comments

Comments
 (0)