1
1
---
2
+ SPDX-FileType : DOCUMENTATION
2
3
SPDX-License-Identifier : Community-Spec-1.0
3
- SPDX-FileCopyrightText : Copyright 2024 The SPDX Contributors
4
4
---
5
5
6
6
# Building the specification website
7
7
8
- The specification website building flow looks like this:
8
+ You may want to build the specification website locally to test your additions
9
+ and edits and review if they render as intended.
9
10
10
11
``` text
11
12
+-------------------+
@@ -28,7 +29,7 @@ The specification website building flow looks like this:
28
29
| +- mkdocs.yml |
29
30
+-------------------+
30
31
|
31
- mkdocs
32
+ MkDocs
32
33
|
33
34
v
34
35
+-------------------+
@@ -40,6 +41,19 @@ The specification website building flow looks like this:
40
41
+-------------------+
41
42
```
42
43
44
+ ## Table of contents
45
+
46
+ 1 . [ Prerequisites] ( #1-prerequisites )
47
+ 1 . [ Getting input files] ( #2-getting-input-files )
48
+ 1 . [ Processing model files (Markdown and RDF)] ( #3-processing-model-files-markdown-and-rdf )
49
+
50
+ - [ Generating model files with spec-parser] ( #31-generating-model-files-with-spec-parser )
51
+ - [ Generating a complete MkDocs configuration file] ( #32-generating-a-complete-mkdocs-configuration-file )
52
+
53
+ 1 . [ Building HTML] ( #4-building-html )
54
+ 1 . [ Configuring the website] ( #5-configuring-the-website )
55
+ 1 . [ Specification versions on spdx.github.io] ( #6-specification-versions-on-spdxgithubio )
56
+
43
57
## 1. Prerequisites
44
58
45
59
Apart from Git and Python, you have to have [ MkDocs] ( http://mkdocs.org )
@@ -83,67 +97,53 @@ pip3 install -r spec-parser/requirements.txt
83
97
* (e.g., chapters and annexes), you can skip to [ step 4] ( #4-building-html ) .*
84
98
85
99
Model files in ` spdx/spdx-3-model ` repository are written in a constrained
86
- Markdown format, with a limited set of allowed headings.
100
+ Markdown format, with [ a predefined set of section headings] [ format ] .
87
101
The ` spec-parser ` processes these model files to generate both ontology files
88
102
and final Markdown files suitable for MkDocs.
89
103
90
104
The ` spec-parser ` also performs automatic formatting on the resulting Markdown
91
105
files. For instance, it converts a list under the "Properties" heading into a
92
106
table.
93
107
108
+ [ format ] : https://github.com/spdx/spdx-3-model/blob/develop/docs/format.md
109
+
94
110
### 3.1 Generating model files with spec-parser
95
111
96
112
To verify the formatting of pre-processed model files and
97
113
prepare them for MkDocs, run the following command:
98
114
99
115
``` shell
100
- python3 spec-parser/main.py spdx-3-model/model parser_output
116
+ python3 spec-parser/main.py \
117
+ --generate-mkdocs --output-mkdocs spdx-spec/docs/model/ \
118
+ spdx-3-model/model/
101
119
```
102
120
103
- * (If ` parser_output ` already exists, the ` spec-parser ` will not overwrite it.)*
104
-
105
- The command will create files in the ` parser_output ` directory.
106
- Among its subdirectories, we're particularly interested in:
107
-
108
- - ` parser_output/mkdocs ` - Processed Markdown files for MkDocs:
109
- These files (` .md ` extension) are located in various
110
- subdirectories and are intended for processing by MkDocs in the next step.
111
- - ` parser_output/rdf ` - Ontology (RDF) files:
112
- These files (` spdx-context.jsonld ` , ` spdx-model.json-ld ` , ` spdx-model.n3 ` ,
113
- ` spdx-model.pretty-xml ` ,` spdx-model.ttl ` , ` spdx-model.xml ` , etc.)
114
- are ready for immediate use.
115
-
116
- - ` parser_output/mkdocs ` : Processed Markdown files (` .md ` ) for MkDocs.
117
- These files will be used by MkDocs in the next step.
118
- - ` parser_output/rdf ` : Ontology (RDF) files, including
119
- ` spdx-context.jsonld ` , ` spdx-model.json-ld ` , ` spdx-model.ttl ` , etc.
120
- These files are ready for immediate use.
121
-
122
- Additionally, a ` parser_output/model-files.yml ` file will be generated.
123
- It contains a list of the files within ` parser_output/mkdocs `
124
- and will be used for MkDocs configuration later.
125
-
126
- ### 3.2 Copying the generated files
121
+ The command will instruct the spec-parser to read the input from
122
+ ` spdx-3-model/model/ ` and generate processed Markdown files (` .md ` ),
123
+ placing them in the ` spdx-spec/docs/model/ ` directory.
124
+ These files will then be used by MkDocs.
127
125
128
- Copy the processed Markdown files and ontology files to the ` docs/ ` directory:
126
+ An ` spdx-spec/docs/model/model-files.yml ` file will also be generated.
127
+ This file contains a list of the files within ` spdx-spec/docs/model/ `
128
+ and will be used later for MkDocs configuration.
129
+ We will move this ` model-files.yml ` file to the ` spdx-spec/ ` directory
130
+ for subsequent use:
129
131
130
132
``` shell
131
- mkdir -p spdx-spec/docs/model
132
- mkdir -p spdx-spec/docs/rdf
133
- cp -R parser_output/mkdocs/* spdx-spec/docs/model
134
- cp -R parser_output/rdf/* spdx-spec/docs/rdf
133
+ mv spdx-spec/docs/model/model-files.yml spdx-spec/
135
134
```
136
135
137
- ### 3.3 Generate a complete MkDocs configuration file
136
+ ### 3.2 Generating a complete MkDocs configuration file
138
137
139
138
To ensure MkDocs recognizes the new Markdown files,
140
- insert the model file list from ` parser_output/model-files.yml `
141
- into the MkDocs configuration file in ` spdx-spec/mkdocs.yml ` .
139
+ insert the model file list from ` model-files.yml `
140
+ into the MkDocs configuration file in ` spdx-spec/mkdocs.yml ` ,
141
+ by using this command:
142
142
143
143
``` shell
144
144
spdx-spec/bin/make-mkdocs-config.sh \
145
145
-b spdx-spec/mkdocs.yml \
146
- -m parser_output /model-files.yml \
146
+ -m spdx-spec /model-files.yml \
147
147
-f spdx-spec/mkdocs-full.yml
148
148
```
149
149
@@ -156,7 +156,7 @@ we will use MkDocs to assemble them into a website.
156
156
157
157
* Note: all the commands below use the configuration file*
158
158
* with the model file list, ` mkdocs-full.yml ` ,*
159
- * generated in [ step 3.3 ] ( #33-generate -a-complete-mkdocs-configuration-file ) .*
159
+ * generated in [ step 3.2 ] ( #32-generating -a-complete-mkdocs-configuration-file ) .*
160
160
* If you only want to review the non-model part of the specification*
161
161
* (have skipped step 3), please use ` mkdocs.yml ` instead.*
162
162
@@ -193,7 +193,7 @@ section. The order of filenames in this section determines the order of the
193
193
page in the navigation bar.
194
194
195
195
After you have modified the configuration file, you may need to rerun
196
- [ step 3.3 ] ( #33-generate -a-complete-mkdocs-configuration-file )
196
+ [ step 3.2 ] ( #32-generating -a-complete-mkdocs-configuration-file )
197
197
to incorporate the changes into the complete configuration file.
198
198
199
199
## 6. Specification versions on spdx.github.io
0 commit comments