-
Notifications
You must be signed in to change notification settings - Fork 0
/
toolchain.en.yhtml2
283 lines (186 loc) · 8.93 KB
/
toolchain.en.yhtml2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
include homepage.en.yhtml2
page "The YML Toolchain" {
h1 > The Toolchain
p >>
There are to possibilities to handle YML files: the YML compiler and the YML/YSLT
processor.
>>
h2 id=compiler > The YML compiler
p >>
The YML ¬http://en.wikipedia.org/wiki/Compiler compiler¬ is a small
¬http://www.python.org Python script¬. It provides the
¬http://en.wikipedia.org/wiki/Command-line_interface command line¬ front end «yml2c».
As default, it compiles your ¬http://en.wikipedia.org/wiki/Scripting_language script¬
and outputs to ¬http://en.wikipedia.org/wiki/Stdout#Standard_output_.28stdout.29 stdout¬,
that usually is the ¬http://en.wikipedia.org/wiki/Computer_terminal terminal¬.
Your ¬http://en.wikipedia.org/wiki/Shell_(computing) shell¬ provides options to redirect
the output into a ¬http://en.wikipedia.org/wiki/Pipeline_(Unix) pipe¬ or
a ¬http://en.wikipedia.org/wiki/Computer_file file¬.
>>
p > So to use it, just enter «yml2c» followed by the filename of your YML script:
Code | % yml2c myscript.yml2 > myscript.result
p > The «yml2c» command has the following options:
h3 > -h, --help
p > Show a help message and exit.
h3 > -C, --old-syntax
p > Use the syntax of YML 2 version 1.x (compatibility mode).
h3 > -D, --emit-linenumbers
p > Emit line numbers into the resulting XML for debugging purposes.
h3 > -E ENCODING, --encoding ENCODING
p > encoding of input files (default: UTF-8)
h3 > -I INCLUDE_PATH, --include=INCLUDE_PATH
p { "Precede " code > ¬features#ymlpath YML_PATH¬
" by a colon separated " code "INCLUDE_PATH"; " (semicolon separated on Windows) to search for include files." }
h3 > -m, --omit-empty-parm-tags
p >>
Does nothing (only there for compatibility with older versions of «yml2c»).
>>
h3 > -n NORMALIZATION, --normalization=NORMALIZATION
p >>
Unicode normalization (none, NFD, NFKD, NFC, NFKC, FCD, default is NFC)
>>
h3 > -o FILE, --output=FILE
p > Don't output to stdout, instead place output in file «FILE».
h3 > -p, --parse-only
p >>
¬http://fdik.org/pyPEG Parse¬ only, then output ¬http://fdik.org/pyPEG/#pyAST pyAST¬
as text to stdout. The pyAST is the
¬http://en.wikipedia.org/wiki/Abstract_syntax_tree Abstract Syntax Tree¬
of the parsed script as ¬http://docs.python.org/library/stdtypes.html Python data structure¬.
>>
h3 > -V, --version
p >>
Show version and ¬http://en.wikipedia.org/wiki/Copyleft Copyleft¬ information of
the YML implementation.
>>
h3 > YML_PATH environment variable
p >>
If «YML_PATH» is set to a colon separated ¬http://en.wikipedia.org/wiki/Path_(computing) path¬
list (semicolon separated on Windows), then the
`a href="features#including" code "include";` statement searches these paths.
If «YML_PATH» is not set, the local directory «.» is searched for files.
The system location for «.yml2» and «.ysl2» files is always searched afterwards.
>>
h2 id=processor > The YML/YSLT processor
p >>
If you're processing more complex tasks, say, executing an YSLT script over some
YML files, the YML/YSLT processor will possible fit better to your needs.
>>
p >>
To use it, enter «yml2proc -y» followed by the filename of your YSLT script,
followed by the filenames of your YML input files:
>>
Code | % yml2proc -y myscript.ysl2 inputfile.yml2 > myscript.result
p > The YML/YSLT processor requires the ¬http://codespeak.net/lxml/ lxml Python library¬.
p > The YML/YSLT processor has the following options:
h3 > -h, --help
p > Show a help message and exit.
h3 > -C, --old-syntax
p > Use the syntax of YML 2 version 1.x (compatibility mode).
h3 > -D, --emit-linenumbers
p > Emit line numbers into the resulting XML for debugging purposes.
h3 id=debug > --debug
p >>
switch on debug tracing to stderr; this enables the functionality
of the ¬yslt#debug debug(msg)¬ and ¬yslt#assert assert yml:assert(test, msg)¬ YSLT functions.
>>
h3 > -E ENCODING, --encoding ENCODING
p > encoding of input files (default: UTF-8)
h3 > -I INCLUDE_PATH, --include=INCLUDE_PATH
p { "Precede " code > ¬features#ymlpath YML_PATH¬
" by a colon separated " code "INCLUDE_PATH"; " (semicolon separated on Windows) to search for include files." }
h3 > -m, --omit-empty-parm-tags
p >>
Does nothing (only there for compatibility with older versions of «yml2proc»).
>>
h3 > -M, --empty-input-document
p >>
Use an empty input document for YSLT or XSLT processing
>>
h3 > -n NORMALIZATION, --normalization=NORMALIZATION
p >>
Unicode normalization (none, NFD, NFKD, NFC, NFKC, FCD, default is NFC)
>>
h3 > -o FILE, --output=FILE
p > Don't output to stdout, instead place output in file «FILE».
h3 > -p, --parse-only
p >>
¬http://fdik.org/pyPEG Parse¬ only, then output ¬http://fdik.org/pyPEG/#pyAST pyAST¬
as text to stdout. The pyAST is the
¬http://en.wikipedia.org/wiki/Abstract_syntax_tree Abstract Syntax Tree¬
of the parsed script as ¬http://docs.python.org/library/stdtypes.html Python data structure¬.
>>
h3 > -e XPATH, --xpath=XPATH
p > Execute XPath expression XPATH and print result
p >>
If you omit -y YSLTSCRIPT, then the result is printed. If you have an additional
-y YSLTSCRIPT parameter, then your YSLT script is processing the result of the
XPath expression only instead of processing the complete content of your input documents
>>
h3 > -P, --pretty
p > Pretty print output adding whitespace
h3 > -x, --xml
p > Input documents are XML already, don't try to convert them from YML
h3 > -y YSLTSCRIPT, --yslt=YSLTSCRIPT
p > Execute YSLT script YSLTSCRIPT
h3 > -X XSLTSCRIPT, --xslt=XSLTSCRIPT
p > Execute XSLT script XSLTSCRIPT
h3 > -d PARAMS, --paramdict=PARAMS
p >>
Call XSLT or YSLT script with dictionary PARAMS as XPath parameters. PARAMS is a Python
expression which evaluates to a Python dictionary.
>>
p > Sample:
p code > yml2proc -y myscript -d 'dict(a=3, b="element[@name=2]")'
h3 > -s STRINGPARAMS, --stringparamdict=STRINGPARAMS
p >>
Call XSLT or YSLT script with dictionary STRINGPARAMS as string parameters. STRINGPARAMS
is a Python expression which evaluates to a Python dictionary.
>>
p > Sample:
p code > yml2proc -y myscript -s 'dict(forename="Hans", name="Meier")'
h3 > -Y, --xml2yml
p > Convert XML to normalized YML. Equivalent to -xy xml2yml.ysl2
h3 > -V, --version
p >>
Show version and ¬http://en.wikipedia.org/wiki/Copyleft Copyleft¬ information of
the YML implementation and exit.
>>
h3 > YML_PATH environment variable
p >>
If «YML_PATH» is set to a colon separated ¬http://en.wikipedia.org/wiki/Path_(computing) path¬
list (semicolon separated on Windows), then the
`a href="features#including" code "include";` statement searches these paths.
If «YML_PATH» is not set, the local directory «.» is searched for files.
The system location for «.yml2» and «.ysl2» files is always searched afterwards.
>>
h2 id=recommended > Recommended external tools
h3 > XSLT Processor
p >>
If you want to use ¬yslt YSLT¬ with «yml2c» instead of «yml2proc», you additionally need an
¬http://www.w3.org/TR/xslt XSLT¬ processor.
>>
p > For that case, I recommend the ¬http://xmlsoft.org/XSLT/xsltproc2.html xsltproc tool¬.
p > To process YSLT, just use a pipe with the «xsltproc» command:
Code | % yml2c customer.ysl2 | xsltproc - customer.xml > customer.html
h3 > XML Renicing Tool
p >>
Sometimes, you may want to have more human readable output with «yml2c». So an
¬http://www.w3.org/XML/ XML¬ renicing tool can be helpful.
>>
p > The ¬http://xmlstar.sourceforge.net/ XMLStarlet¬ command line tool may be of interest.
p > Have a look on its «fo» command.
h3 > Windows tool chain
p >>
See also the tips for a
¬http://www.auchdieserschwachsinnmussinsinternet.de/2009-03/#s1236859037 Windows tool chain¬
for YML.
>>
h1 id=downloads > Downloads
p > You can here ¬https://gitea.pep.foundation/fdik/yml2 download the newest release of YML¬.
div id=bottom {
a href="yslt" "<< back to YSLT" " "
a href="#top" "^Top^" " "
a href="toolchain.en.yhtml2" "(source)"
}
}