nextguidefmt 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nextguidefmt/__init__.py +22 -0
- nextguidefmt/__main__.py +148 -0
- nextguidefmt/doc.py +453 -0
- nextguidefmt/index.py +733 -0
- nextguidefmt/node.py +433 -0
- nextguidefmt/set.py +358 -0
- nextguidefmt/token.py +197 -0
- nextguidefmt-2.0.0.dist-info/METADATA +225 -0
- nextguidefmt-2.0.0.dist-info/RECORD +11 -0
- nextguidefmt-2.0.0.dist-info/WHEEL +5 -0
- nextguidefmt-2.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nextguidefmt
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Python ZX Spectrum Next NextGuide formatting utility
|
|
5
|
+
Home-page: https://github.com/mincebert/nextguidefmt
|
|
6
|
+
Author: Robert Franklin
|
|
7
|
+
Project-URL: Bug Reports, https://github.com/mincebert/nextguidefmt/issues
|
|
8
|
+
Project-URL: Source, https://github.com/mincebert/nextguidefmt
|
|
9
|
+
Keywords: specnext nextguide
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
Dynamic: author
|
|
22
|
+
Dynamic: classifier
|
|
23
|
+
Dynamic: description
|
|
24
|
+
Dynamic: description-content-type
|
|
25
|
+
Dynamic: home-page
|
|
26
|
+
Dynamic: keywords
|
|
27
|
+
Dynamic: project-url
|
|
28
|
+
Dynamic: summary
|
|
29
|
+
|
|
30
|
+
ZX Spectrum Next Guide Formatter
|
|
31
|
+
================================
|
|
32
|
+
|
|
33
|
+
The ZX Spectrum Next operating system comes with a hypertext viewer called
|
|
34
|
+
_NextGuide_ which is used for viewing online information, including system
|
|
35
|
+
documentation, similar to _AmigaGuide_ on the Commodore Amiga.
|
|
36
|
+
|
|
37
|
+
NextGuide requires that documents are preformatted with regards line length and
|
|
38
|
+
word wrap. The hypertext links and formatting (justification, attributes,
|
|
39
|
+
etc.) are achieved through markup commands, which can make it difficult to
|
|
40
|
+
calculate when to wrap a line of text to fit on the screen correctly.
|
|
41
|
+
|
|
42
|
+
In addition, the documents need to contain commands linking pages together,
|
|
43
|
+
e.g. to the next and previous nodes (pages). As nodes are inserted, moved or
|
|
44
|
+
removed, these must be adjusted manually.
|
|
45
|
+
|
|
46
|
+
Finally, links can point to nodes in other documents (in version 1.1 and
|
|
47
|
+
later) by using the syntax `@{"..." LINK <doc>:<node>}`. If a document is part
|
|
48
|
+
of a set, and nodes are moved between documents, as the set is reorganised, it
|
|
49
|
+
is difficult to maintain a link to the correct document.
|
|
50
|
+
|
|
51
|
+
This utility, `nextguidefmt`, attempts to resolve these issues by processing
|
|
52
|
+
the source documents to perform a number of tasks:
|
|
53
|
+
|
|
54
|
+
* calculate displayed line lengths of word wrap text
|
|
55
|
+
* populate links between previous and next nodes in a document automatically
|
|
56
|
+
* fix links to nodes in other documents by qualifying them with the correct
|
|
57
|
+
document name and separator character
|
|
58
|
+
* automatically consolidate index nodes across a set of documents into a single
|
|
59
|
+
index
|
|
60
|
+
* check documents for broken links and other mistakes
|
|
61
|
+
|
|
62
|
+
These functions are described below.
|
|
63
|
+
|
|
64
|
+
Usage
|
|
65
|
+
-----
|
|
66
|
+
|
|
67
|
+
The utility is an excecutable Python module and can be run with the `-m`
|
|
68
|
+
option and the name of the module. `-h` gives help:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
usage: nextguidefmt [-h] [-o OUTPUT_DIR] [-i] [-I SUBINDEX] [-p PREFIX] [-c]
|
|
72
|
+
[-w] [-n] [-t TEXT_FILE] [-G] [-v]
|
|
73
|
+
file [file ...]
|
|
74
|
+
|
|
75
|
+
positional arguments:
|
|
76
|
+
file filename of NextGuide document(s) to read
|
|
77
|
+
|
|
78
|
+
options:
|
|
79
|
+
-h, --help show this help message and exit
|
|
80
|
+
-o OUTPUT_DIR, --output-dir OUTPUT_DIR
|
|
81
|
+
directory to write out formatted NextGuide files
|
|
82
|
+
-i, --index recreate index pages, including common index across
|
|
83
|
+
set
|
|
84
|
+
-I SUBINDEX, --subindex SUBINDEX
|
|
85
|
+
additional node name to process as a subindex, besides
|
|
86
|
+
the one named in the '@index' document command
|
|
87
|
+
-p PREFIX, --index-term-prefix PREFIX
|
|
88
|
+
leading strings to ignore when sorting and grouping
|
|
89
|
+
index terms - e.g. if set to '.' then '.term' as a
|
|
90
|
+
term will be sorted and grouped under 't'; note this
|
|
91
|
+
can be a string and not just a single character, and
|
|
92
|
+
this option can be used multiple times for multiple
|
|
93
|
+
prefixes
|
|
94
|
+
-c, --no-check-consistency
|
|
95
|
+
don't check document level commands across the set for
|
|
96
|
+
consistency (commands checked are: author, copyright,
|
|
97
|
+
version)
|
|
98
|
+
-w, --no-warnings suppress printing of warnings encountered during
|
|
99
|
+
formatting to stdandard error
|
|
100
|
+
-n, --nodes print a list of all nodes in the set to standard
|
|
101
|
+
output
|
|
102
|
+
-r, --readable render a readable, plain text version of the guide set
|
|
103
|
+
to standard output: remove markup, skip index pages,
|
|
104
|
+
highlight links, don't print filenames; only used if
|
|
105
|
+
-o is not specified
|
|
106
|
+
-v, --version show program's version number and exit
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Word wrap
|
|
110
|
+
---------
|
|
111
|
+
|
|
112
|
+
The displayed length of lines, without markup commands, are calculated and
|
|
113
|
+
lines in the source document will be word wrapped at the appropriate length (80
|
|
114
|
+
characters).
|
|
115
|
+
|
|
116
|
+
There are some exceptions to this, with lines matching certain criteria being
|
|
117
|
+
treated as _literal_ lines that have been preformatted and shouldn't be
|
|
118
|
+
processed. These are lines with:
|
|
119
|
+
|
|
120
|
+
* leading spaces,
|
|
121
|
+
* three or more consecutive spaces,
|
|
122
|
+
* lines with _header_ commands (`@{hN}`),
|
|
123
|
+
* lines with centred or right-justified text (`@{c}` or `@{r}`), or
|
|
124
|
+
* lines consisting solely of a single link (`@{"..." LINK ...}`).
|
|
125
|
+
|
|
126
|
+
These are set to avoid having to manually override the formatting performed by
|
|
127
|
+
the utility, in the vast majority of cases.
|
|
128
|
+
|
|
129
|
+
Adjacent node link completion
|
|
130
|
+
-----------------------------
|
|
131
|
+
|
|
132
|
+
If the `@prev` or `@next` command is not defined for a particular node, the
|
|
133
|
+
previous or next node in the document are automatically inserted, maintaining
|
|
134
|
+
the correct order for stepping through the nodes in a guide.
|
|
135
|
+
|
|
136
|
+
If the `@toc` (table of contents) command is not defined for a node, the value
|
|
137
|
+
from the previous node will be re-used. This allows the contents node to be
|
|
138
|
+
specified once at the beginning, or only as it needs to change.
|
|
139
|
+
|
|
140
|
+
To avoid these being automatically completed (in particular `@toc`), the
|
|
141
|
+
special value "`-`" can be specified.
|
|
142
|
+
|
|
143
|
+
Fix links to other documents
|
|
144
|
+
----------------------------
|
|
145
|
+
|
|
146
|
+
The utility can process a set of documents in one go, allowing it to build up
|
|
147
|
+
a table of which node is in which document. If a node contains a link to a
|
|
148
|
+
node which is in another document in the set, the target of that link will be
|
|
149
|
+
qualified with the document name, when it is written out.
|
|
150
|
+
|
|
151
|
+
For example, if _Node1_ in _Document1_ contains a link command of the form
|
|
152
|
+
`@{" to Node 2 " LINK Node2}`, and _Node2_ resides in _Document2_, the link
|
|
153
|
+
will be rewritten to `@{" to Node 2 " LINK Document2:Node2}`, which will instruct the NextGuide viewer to load the `Document2` guide file and select
|
|
154
|
+
`Node2`.
|
|
155
|
+
|
|
156
|
+
Consolidated index
|
|
157
|
+
------------------
|
|
158
|
+
|
|
159
|
+
NextGuide documents support a single _index_ page which can be visited by
|
|
160
|
+
pushing `i` (or selecting a link to it). If a particular guide set is spread
|
|
161
|
+
across multiple documents, this can make maintaining a large index, including
|
|
162
|
+
all the terms and the links to the appropriate nodes, difficult.
|
|
163
|
+
|
|
164
|
+
If this function is enabled (through the `-i` option), the utility will find
|
|
165
|
+
the index node in each document (as identified by the `@index` command) and
|
|
166
|
+
parse the lines in it to create a single, consolidated index for the set.
|
|
167
|
+
|
|
168
|
+
For this to work, lines in the index node must match a very specific format:
|
|
169
|
+
|
|
170
|
+
* they can start with 0-2 spaces, followed by
|
|
171
|
+
* the _term_ - a piece of static text (with no more than two spaces between
|
|
172
|
+
each word), or a `LINK` command, followed by
|
|
173
|
+
* 3 or more spaces, followed by
|
|
174
|
+
* the _references_ - a list of `LINK`s separated by one comma and zero or more
|
|
175
|
+
spaces
|
|
176
|
+
|
|
177
|
+
If a line starts with 5 or more spaces, then contains a list of references, it
|
|
178
|
+
continues the term used on the previous line.
|
|
179
|
+
|
|
180
|
+
This information is used to assemble a single index containing all terms and,
|
|
181
|
+
for each term, all the references. The terms in the index are sorted into
|
|
182
|
+
ASCIIbetical order, with all non alphanumeric characters first (i.e. symbols).
|
|
183
|
+
|
|
184
|
+
Additional node names can be specified as providing indexes using the `-I`
|
|
185
|
+
(subindex) option. These will be consolidated and processed in the same way.
|
|
186
|
+
|
|
187
|
+
Note: there is a limitation of 255 links per node. The program will produce a
|
|
188
|
+
warning if this is exceeded (on any node, including a generated index node)
|
|
189
|
+
but it is currently not worked around. A solution may be to split the index
|
|
190
|
+
into two tiers, but this can be worked around manually using the subindex
|
|
191
|
+
feature.
|
|
192
|
+
|
|
193
|
+
Checking
|
|
194
|
+
--------
|
|
195
|
+
|
|
196
|
+
All the links made in a guide set, either through the `@{"..." LINK ...}`
|
|
197
|
+
command, or through node/document commands (such as `@next` and `@toc`), will
|
|
198
|
+
be checked to ensure that the document does not contain any broken links to
|
|
199
|
+
non-existent nodes.
|
|
200
|
+
|
|
201
|
+
If a node name is re-used within a document or across two documents in a set,
|
|
202
|
+
a warning will be generated. This latter restriction is to avoid ambiguity
|
|
203
|
+
when fixing links across documents. The index node is exempted from this
|
|
204
|
+
restriction.
|
|
205
|
+
|
|
206
|
+
The current version of NextGuide limits individual documents to 64KBytes in
|
|
207
|
+
size. If this is exceeded, a warning will be generated.
|
|
208
|
+
|
|
209
|
+
Various document level commands will also be checked for consistency across
|
|
210
|
+
the documents in a set - author, copyright and version - and a warning
|
|
211
|
+
generated if they don't match. This particular check can be disabled using the
|
|
212
|
+
`-c` command line option.
|
|
213
|
+
|
|
214
|
+
For reference purposes, with the `-n` option, the utility can also output a
|
|
215
|
+
list of all nodes in the set, along with this document they appear in, sorted
|
|
216
|
+
by node name order.
|
|
217
|
+
|
|
218
|
+
Readable, plain-text version
|
|
219
|
+
----------------------------
|
|
220
|
+
|
|
221
|
+
The `-r` option will generate a "readable" version of the guide set in plain
|
|
222
|
+
text, without markup, and print it to standard output.
|
|
223
|
+
|
|
224
|
+
This is useful if a version of the guide that doesn't need the NextGuide
|
|
225
|
+
viewer (or a Spectrum Next) is required.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
nextguidefmt/__init__.py,sha256=NU4YNvtDmWeAanNPF4xeVR0672O_nhFT1rO9RhGrjbA,343
|
|
2
|
+
nextguidefmt/__main__.py,sha256=rLiVbo9jqwmVYUxJiddaKOyW_MiWSEhe94byJ9rY9kw,4587
|
|
3
|
+
nextguidefmt/doc.py,sha256=zwYVpokvZFayLOx0h4PpwGH3ZYrgNxlRZzb5jQDNTsQ,14147
|
|
4
|
+
nextguidefmt/index.py,sha256=hUA32cvQYoujWW9MBySHd2UELyN9pA_GC5J5itCpSIY,25835
|
|
5
|
+
nextguidefmt/node.py,sha256=QTCyNfO20fxE7spzttxprdsIjKG_FwDRCaYOLrlAi24,13411
|
|
6
|
+
nextguidefmt/set.py,sha256=mLeafxTDFVC7tC4LP8GAfnbMMyCCprL-CFs3bl6SWaM,12396
|
|
7
|
+
nextguidefmt/token.py,sha256=2QrxyS6YqGlYAKxKbQyfUFbz1zNMPHk77kjgKik1ZdU,5505
|
|
8
|
+
nextguidefmt-2.0.0.dist-info/METADATA,sha256=U8VuB7t6mb8pxw2xLuXqI7TE1m2y_vlxAqGR2Fy8uVU,9975
|
|
9
|
+
nextguidefmt-2.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
10
|
+
nextguidefmt-2.0.0.dist-info/top_level.txt,sha256=NpuejYA_AOmRzN9t65XFcJ0zU-fbp6NnrTu7BKrxGZk,13
|
|
11
|
+
nextguidefmt-2.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nextguidefmt
|