File: wml.src

package info (click to toggle)
wml 2.32.0~ds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, trixie
  • size: 1,812 kB
  • sloc: perl: 6,963; ansic: 747; yacc: 154; makefile: 107; sh: 25
file content (506 lines) | stat: -rw-r--r-- 15,171 bytes parent folder | download | duplicates (2)
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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
#!@PATH_PERL@
eval 'exec @PATH_PERL@ -S $0 ${1+"$@"}'
    if $running_under_some_shell;
##
##  WML -- Website META Language
##
##  Copyright (c) 1996-2001 Ralf S. Engelschall.
##  Copyright (c) 1999-2001 Denis Barbier.
##
##  This program is free software; you can redistribute it and/or modify
##  it under the terms of the GNU General Public License as published by
##  the Free Software Foundation; either version 2 of the License, or
##  (at your option) any later version.
##
##  This program is distributed in the hope that it will be useful,
##  but WITHOUT ANY WARRANTY; without even the implied warranty of
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##  GNU General Public License for more details.
##
##  You should have received a copy of the GNU General Public License
##  along with this program; if not, write to
##
##      Free Software Foundation, Inc.
##      59 Temple Place - Suite 330
##      Boston, MA  02111-1307, USA
##
##  Notice, that ``free software'' addresses the fact that this program
##  is __distributed__ under the term of the GNU General Public License
##  and because of this, it can be redistributed and modified under the
##  conditions of this license, but the software remains __copyrighted__
##  by the author. Don't intermix this with the general meaning of
##  Public Domain software or such a derivated distribution label.
##
##  The author reserves the right to distribute following releases of
##  this program under different conditions or license agreements.
##

use strict;
use warnings;

use lib "@INSTALLPRIVLIB@";
use lib "@INSTALLARCHLIB@";
use lib "/usr/share/wml";

use TheWML::Frontends::Wml::Runner ();

TheWML::Frontends::Wml::Runner->new->run_with_ARGV(
    {
        ARGV => [@ARGV],
    }
);

#   exit gracefully
exit(0);

##EOF##
__END__

=head1 NAME

WML - Website META Language

=head1 VERSION

@WML_VERSION@

=head1 SYNOPSIS

B<wml>
[B<-I> I<PATH>]
[B<-i> I<PATH>]
[B<-D> I<NAME>B<=>I<STR>]
[B<-D> I<NAME>B<~>I<PATH>]
[B<-n>]
[B<-r>]
[B<-O> I<level>]
[B<-o> [I<SLICETERM>C<:>]I<PATH>[B<@>I<CHMODOPT>]]
[B<-P> I<PATH>]
[B<-E> I<PATH>]
[B<-t>]
[B<-p> I<STR>]
[B<-W> I<STR>]
[B<-s>]
[B<-v> [I<NUM>]]
[B<-q>]
[I<inputfile>]

B<wml>
[B<-V> [I<NUM>]]
[B<-h>]

=head1 DESCRIPTION

This is the control program of the I<Website META Language> (WML), a free HTML
generation toolkit for Unix, internally consisting of 9 independent languages.

The main idea of WML is a sequential filtering scheme where each language
provides one of 9 processing passes.  So F<wml> reads I<inputfile> (or from
F<stdin> if I<inputfile> is a dash or completely missing), applies passes 1-9
(or only the passes specified by B<-p>) and finally produces one or more
I<outputfile>s.

For more details on this processing scheme read the I<WML Introduction> under
wml_intro(7) and the I<WML Tutorial> under wml_tutorial(7).

=head1 OPTIONS

=over

=item B<-I>, B<--include=>I<PATH>

Adds a I<directory> to the list of user include paths. Use this option to set the
runtime environment for pass 1. See wml_p1_ipp(1) for more details.

=item B<-i>, B<--includefile=>I<PATH>

Pre-loads a particular include I<file>, i.e. virtually adds a

  #include "PATH"

at the top of I<inputfile>. Use this to automatically include default user
include files. If you want to include a systems include file you have to
surround the I<PATH> with angle brackets, for instance use ``C<-i>
C<"E<lt>foo/bar.wmlE<gt>">'' to include the file F<foo/bar.wml> from the
system include area.  Alternatively you can use the special syntax
``C<wml::foo::bar>'' as with the C<#use> directive.

=item B<-D>, B<--define=>I<NAME>B<=>I<STR>

Defines a variable which can be interpolated in pass 1 (IPP) via C<$(NAME)>, in
pass 2 (mp4h) via E<lt>C<get-var NAME>E<gt>, in pass 3 (ePerl) via
C<E<lt>:=$NAME:E<gt>> and in pass 4 (GNU m4) via C<m4_NAME>.
A special variant B<--define=>I<NAME>B<=UNDEF> does the opposite, it
deletes previous definitions (which may be different than undefining
these variables, e.g. with system defined variables).

=item B<-D>, B<--define=>I<NAME>B<~>I<PATH>

Similar to the above but defines a variable holding a pathname which is
autoadjusted (see below).  It can be interpolated in the same ways as the
C<NAME=STR> variant from above.

=item B<-n>, B<--noshebang>

This forces WML to ignore a possibly contained shebang line in I<inputfile>.
This is usually used by WMk, because WMk already parsed this line and supplied
the options to WML.

=item B<-r>, B<--norcfile>

This forces WML to ignore all F<.wmlrc> files.

=item B<-c>, B<--nocd>

When WML processes an input file from another directory, it jumps into
that directory before parsing F<.wmlrc> files, and jump back to current
directory after.  If this option is set, no directory change is made and
F<.wmlrc> files are read reative to current working directory.

=item B<-O>, B<--optimize=>I<NUM>

This is the optimization option which is passed directly to pass 8
(F<htmlfix>). It controls the amount of optimization/stripping which is
applied to the generated HTML markup code.

=item B<-o>, B<--outputfile=>I<SLICETERM>B<:>I<outputfile>[B<@>I<CHMODOPT>]

This redirects the output to a file. Usually the whole file will be send to
F<stdout> (same as C<ALL:->). You can use this option more than once to output
to more than one file while using the I<SLICETERM> as a set theory term of
slices to determine which contents will be included into each particular
output file.  The optional I<CHMODOPT> is intended for specifying options for
a finally applied F<chmod> command. For instance use ``C<u+x>'' to create a
file with the execution bit set (Apache's XBitHack feature).
See wml_p9_slice(1) for more details.

=item B<-P>, B<--prolog=>I<PATH>

Runs an prolog filter over the input file.  This program receives the data to
act on as STDIN and has to produce the filtered data on STDOUT.

=item B<-E>, B<--epilog=>I<PATH>

Runs an epilogue program over the finally resulting output files.  Currently
the following WML-specific programs are known: F<htmlinfo>, F<linklint>,
F<tidy> and F<weblint>.  But you can specify any program which is available in
your C<PATH>. This program receives the file to act on as its first command
line argument. Notice that output is not redirected to this file, so you have
to use a wrapper or program specific flags if you want to modify output files.

=item B<-t>, B<--settime>

This sets the modification time of all output files to the modification time
of I<intputfile> plus 1 second. This is useful because Webservers will
generate C<Last-Modified> headers and there the editing time is more important
than the generation time. The 1 second offset is for the dependencies
of Makefiles.

=item B<-M>, B<--depend>[B<=>I<OPTIONS>]

Output a rule suitable for `make' describing the dependencies of each output
file, as `gcc' does. It has only sense when the B<-o> option is used.
No processing is done except for the first pass.

The B<D> flag option writes the rule to a dependency file. The name of
this file is obtained by replacing the suffix of the output file by ".d".

The B<M> flag option deletes the system files from the list of dependencies.

=item B<-p>, B<--pass=>I<STR>

Specifies which of the passes described above are actually applied under
runtime. The argument I<STR> is a comma-separated list of pass numbers with
one special case: You can write C<X-Y> for all passes C<X...Y>.  When pass 9
is not part of I<STR> the resulting output is written to F<STDOUT>. Default is
the string ``C<1-9>''.

=item B<-W>, B<--passoption=>I<NUM>,I<STR>

Set option I<STR> for the pass I<NUM>.

=item B<-s>, B<--safe>

This disables some Perl hacks inside WML which speedup processing by reducing
the forking overhead when running the various passes.

Without this option WML pre-compiles the passes 1,5,6,7,8 (which are written
in Perl!) into a different namespace of the currently running Perl interpreter
instead of running them externally via C<system()>. The effect is that these
programs are run from within the same Perl interpreter thus saving five CPU-
and time-intensive C<fork()>'s. The actual gain is between 2 and 4 seconds of
processing time. Although experience showed that it works great, the
theoretical problem still is, that this approach is somewhat risky due to
internal Perl variable conflicts.

Use this option to disable these speedups by forcing WML to use the safe
C<fork()> approach.

=item B<-v>, B<--verbose>[B<=>I<NUM>]

This sets verbose mode (from 1 to 9) where some processing information will be
given on the console. Useful for debugging. This option also gets passed to
some of the filtering programs. Default is no verbosity and just B<-v> means
B<-v1>.

=item B<-q>, B<--quiet>

This sets quiet mode where the processing prop is no longer displayed.  Use
this option when running F<wml> as a batch job.  This option is automatically
forced when I<inputfile> is missing.  Then WML automatically reads from
F<stdin> in quiet mode.

=item B<-V>, B<--version>[B<=>I<NUM>]

Gives the version identification string and disclaimer (no I<NUM> or I<NUM>
E<gt>= 1), the WML build information (I<NUM> E<gt>= 2) and the Perl build
information (I<NUM> E<gt>= 3). Use this option to get a brief description of
your installed WML system, especially when reporting bugs to the author.

=item B<-h>, B<--help>

Prints the usage summary page.

=back

=head1 ENVIRONMENT

=head2 DEFINED VARIABLES

The following variables are always defined by F<wml> under runtime and are
usually interpolated via E<lt>C<get-var NAME>E<gt> inside Pass 2 and via
C<$NAME> in Pass 3.

=over 4

=item WML_SRC_DIRNAME

The current working directory from where F<wml> was started.
An absolute Unix filesystem path.

=item WML_SRC_FILENAME

The name of the I<inputfile> from the command line. Useful when running F<wml>
on a bulk of files and includefiles have to determine in which they are
included.

=item WML_SRC_BASENAME

The basename of the I<inputfile>, i.e. the C<WML_SRC_FILENAME>, but with the
extension already stripped.

=item WML_SRC_TIME

The last modification time of I<inputfile> in C<time()> format.
Useful inside footers when customized date format is needed.

=item WML_SRC_CTIME

The last modification time of I<inputfile> in C<ctime()> format.
Useful inside footers include files.

=item WML_SRC_ISOTIME

The last modification time of I<inputfile> in ISO C<yyyy-mm-dd hh:mm:ss> format.
Useful inside footers include files.

=item WML_SRC_USERNAME

The Unix username of the user who own I<inputfile>.

=item WML_SRC_REALNAME

The realname of the user who own I<inputfile>.

=item WML_GEN_TIME

The current time of generation in C<time()> format.
Useful inside footers when customized date format is needed.

=item WML_GEN_CTIME

The current time of generation in C<ctime()> format.
Useful inside footers include files.

=item WML_GEN_ISOTIME

The current time of generation in ISO C<yyyy-mm-dd hh:mm:ss> format.
Useful inside footers include files.

=item WML_GEN_USERNAME

The Unix username of the user who runs the F<wml> process.

=item WML_GEN_REALNAME

The realname of the user who runs the F<wml> process.

=item WML_GEN_HOSTNAME

The name of the host on which the F<wml> command runs.

=item WML_LOC_PREFIX

The location prefix where WML was installed to at built time.

=item WML_LOC_BINDIR

The directory where WML's binaries were installed to at built time.

=item WML_LOC_LIBDIR

The directory where WML's library files were installed to at built time.

=item WML_LOC_MANDIR

The directory where WML's manual pages were installed to at built time.

=item WML_VERSION

The version identification string of WML.  Use this for instance in HTML
comments inside header includes to identify the generation tools version.

=back

=head2 USED VARIABLES

=over 4

=item C<WMLOPTS>

This variable can contain a string of options.  Usually this is used by
Bourne-Shell users like

  $ WMLOPTS="-DNAME1=VALUE2 -DNAME2=VALUE2"
  $ export WMLOPTS

and by C-Shell users like

  $ setenv WMLOPTS "-DNAME1=VALUE2 -DNAME2=VALUE2"

to make sure some variables are defined for all runs of F<wml>.

=item C<PAGER>

This variable contains the pager WML is to use. WML uses a pager when
called with the B<--verbose=>I<NUM> or B<-v>I<NUM> option respectively and
I<NUM> is 3 or higher and therefore showing the processed data after
each pass.  Default is 'more'.

=item C<TMPDIR>

This variable contains the directory WML stores its temporary files in.
Default is '/tmp'.

=back

=head1 USER FILES

=over 4

=item F<$HOME/.wmlrc> and F<(../)*.wmlrc>

These files can also contain option strings, one option per line.  Usually the
contents is one or more B<-D> options, especially auto-adjusted ones:

  -DROOTREL~.
  -DROOTABS=http://thishost/thisarea/
     :
  -DNAME1=VALUE1
  -DNAME2=VALUE2
     :

=back

=head1 STANDARD INCLUDE FILES

WML is shipped with a standard set of include files.
You can directly include them via

  #use wml::category::name

and read their own documentation via

  $ man wml::category::name

See wml::all(3) for a description of all available include files.

=head1 SPECIAL FEATURES

The WML control frontend provides a few special features on its own:

=over 4

=item Shebang Line Support

WML recognizes a I<shebang> line (``C<#!wml> I<options>'') in the F<.wml>
files and automatically adds I<options> to its command line. This line is also
used by WMk. Two special features in contrast to shebang lines for the Unix
loader are available: WML's shebang line can be continued via a backslash
character and the constructs C<%DIR> and %<BASE> are interpolated (where
C<%DIR> is the path to the directory the source while resides and C<%BASE> is
the filename of the source file without any extension).

Example:

  #!wml -o (ALL-LANG_*)+LANG_EN:%BASE.en.html \
        -o (ALL-LANG_*)+LANG_DE:%BASE.de.html

=item Data Protection Container Tag

WML provides an own internal container tag named C<E<lt>protect
[pass=SPEC]E<gt>>...C<E<lt>/protectE<gt>> which can be used to protect any type
of data from being processed by any WML pass. When no C<pass> attribute is
given I<SPEC> defaults to C<1-9>. When you use C<pass> then I<SPEC> can be
either C<#->, C<-#>, C<#-#> or a comma separated list of passes, while
C<#> can be between C<1> and C<9>.

Example:

   <script language="JavaScript">
   <protect pass=2>
   ...
   output = "<PRE><DIV ALIGN=\"CENTER\"><B>" + help_string + "</B></DIV></PRE>"
   ...
   </protect>
   </script>

Warning:

Since WML 2.0.3, pass 1 includes extra stuff to help keeping information
about line numbers relevant (a la cpp).  So when writing

   <protect pass=2>
   #include 'foo'
   </protect>

these extra commands will not be interpreted during pass 2 and will
remain on output.  To suppress them, either compile with C<-W1,-N> flag,
or write

   <protect pass=2>
   #include 'foo' IPP_NOSYNCLINES
   </protect>

=back

=head1 AUTHORS

 Ralf S. Engelschall
 rse@engelschall.com
 www.engelschall.com

 Denis Barbier
 barbier@engelschall.com

=head1 SEE ALSO

wmd(1),
wml_faq(7),
wml_intro(7),
wml_tutorial(7),
wml_tags(7),
wml::all(3).

=cut
# vim: ft=perl