.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "MP4H 1" .TH MP4H 1 "2018-06-27" "HTML Tools" "HTML Tools" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" mp4h \- Macro Processor for HTML Documents .SH "VERSION" .IX Header "VERSION" This documentation describes mp4h version 1.3.1. .SH "INTRODUCTION" .IX Header "INTRODUCTION" The \fBmp4h\fR software is a macro-processor specifically designed to deal with \s-1HTML\s0 documents. It allows powerful programming constructs, with a syntax familiar to \s-1HTML\s0 authors. .PP This software is based on \&\fBMeta-HTML\fR \f(CW\*(C`\*(C'\fR, written by Brian J. Fox, Even if both syntaxes look similar, source code is completely different. Indeed, a subset of \fBMeta-HTML\fR was used as a part of a more complex program, \fB\s-1WML\s0\fR (Website Meta Language \f(CW\*(C`\*(C'\fR) written by Ralf S. Engelschall and which I maintain since January 1999. For licensing reasons, it was hard to hack \fBMeta-HTML\fR and so I decided to write my own macro-processor. .PP Instead of rewriting it from scratch, I preferred using another macro-processor engine. I chose \&\s-1GNU\s0 \fBm4\fR \f(CW\*(C`\*(C'\fR, written by Rene Seindal, because of its numerous advantages : this software is stable, robust and very well documented. This version of \fBmp4h\fR is derived from \s-1GNU\s0 \fBm4\fR version 1.4n, which is a development version. .PP The \fBmp4h\fR software is not an \s-1HTML\s0 editor; its unique goal is to provide an easy way to define its own macros inside \s-1HTML\s0 documents. There is no plan to add functionalities to automagically produce valid \&\s-1HTML\s0 documents, if you want to clean up your code or validate it, simply use a post-processor like tidy \f(CW\*(C`\*(C'\fR. .SH "COMMAND LINE OPTIONS" .IX Header "COMMAND LINE OPTIONS" Optional arguments are enclosed within square brackets. All option synonyms have a similar syntax, so when a long option accepts an argument, short option do too. .PP Syntax call is .PP .Vb 1 \& mp4h [options] [filename [filename] ...] .Ve .PP Options are described below. If no filename is specified, or if its name is \f(CW\*(C`\-\*(C'\fR, then characters are read on standard input. .SS "Operation modes" .IX Subsection "Operation modes" .IP "\fB\-\-help\fR display an help message and exit" 2 .IX Item "--help display an help message and exit" .PD 0 .IP "\fB\-\-version\fR output \fBmp4h\fR version information and exit" 2 .IX Item "--version output mp4h version information and exit" .IP "\fB\-E \-\-fatal\-warnings\fR stop execution after first warning" 2 .IX Item "-E --fatal-warnings stop execution after first warning" .IP "\fB\-Q \-\-quiet \-\-silent\fR suppress some warnings for builtins" 2 .IX Item "-Q --quiet --silent suppress some warnings for builtins" .ie n .IP "\fB\-S \-\-safety\-level=\f(CB""NUMBER""\fB\fR disable risky functions; 0 means no filtering, 1 disable ""execute"" and 2 disable this one too plus all filesystem related functions: ""file\-exists"", ""real\-path"", ""get\-file\-properties"", ""directory\-contents"" and ""include""." 2 .el .IP "\fB\-S \-\-safety\-level=\f(CBNUMBER\fB\fR disable risky functions; 0 means no filtering, 1 disable \f(CWexecute\fR and 2 disable this one too plus all filesystem related functions: \f(CWfile\-exists\fR, \f(CWreal\-path\fR, \f(CWget\-file\-properties\fR, \f(CWdirectory\-contents\fR and \f(CWinclude\fR." 2 .IX Item "-S --safety-level=NUMBER disable risky functions; 0 means no filtering, 1 disable execute and 2 disable this one too plus all filesystem related functions: file-exists, real-path, get-file-properties, directory-contents and include." .PD .SS "Preprocessor features" .IX Subsection "Preprocessor features" .ie n .IP "\fB\-I \-\-include=\f(CB""DIRECTORY""\fB\fR search this directory for includes and packages" 2 .el .IP "\fB\-I \-\-include=\f(CBDIRECTORY\fB\fR search this directory for includes and packages" 2 .IX Item "-I --include=DIRECTORY search this directory for includes and packages" .PD 0 .ie n .IP "\fB\-D \-\-define=\f(CB""NAME\f(CB""[=VALUE]""\f(CB""\fB\fR set variable \s-1NAME\s0 to \s-1VALUE,\s0 or empty" 2 .el .IP "\fB\-D \-\-define=\f(CBNAME\f(CB[=VALUE]\f(CB\fB\fR set variable \s-1NAME\s0 to \s-1VALUE,\s0 or empty" 2 .IX Item "-D --define=NAME[=VALUE] set variable NAME to VALUE, or empty" .ie n .IP "\fB\-U \-\-undefine=\f(CB""COMMAND""\fB\fR delete builtin \s-1COMMAND\s0" 2 .el .IP "\fB\-U \-\-undefine=\f(CBCOMMAND\fB\fR delete builtin \s-1COMMAND\s0" 2 .IX Item "-U --undefine=COMMAND delete builtin COMMAND" .ie n .IP "\fB\-s \-\-synclines\fR generate `#line \s-1NO ""FILE""\s0' lines" 2 .el .IP "\fB\-s \-\-synclines\fR generate `#line \s-1NO ``FILE''\s0' lines" 2 .IX Item "-s --synclines generate `#line NO FILE' lines" .PD .SS "Parser features" .IX Subsection "Parser features" .ie n .IP "\fB\-c \-\-caseless=\f(CB""NUMBER""\fB\fR set case sensitiveness according to the bits of ""NUMBER"". A null bit means symbol is case sensitive, and bits are defined as followed: 0 for tags, 1 for variables and 2 for entities. Default value is 3, i.e. only entities are case sensitive." 2 .el .IP "\fB\-c \-\-caseless=\f(CBNUMBER\fB\fR set case sensitiveness according to the bits of \f(CWNUMBER\fR. A null bit means symbol is case sensitive, and bits are defined as followed: 0 for tags, 1 for variables and 2 for entities. Default value is 3, i.e. only entities are case sensitive." 2 .IX Item "-c --caseless=NUMBER set case sensitiveness according to the bits of NUMBER. A null bit means symbol is case sensitive, and bits are defined as followed: 0 for tags, 1 for variables and 2 for entities. Default value is 3, i.e. only entities are case sensitive." .PD 0 .ie n .IP "\fB\-e \-\-encoding=\f(CB""NAME""\fB\fR specify document encoding. Valid options are `8bit' (default) or `utf8'." 2 .el .IP "\fB\-e \-\-encoding=\f(CBNAME\fB\fR specify document encoding. Valid options are `8bit' (default) or `utf8'." 2 .IX Item "-e --encoding=NAME specify document encoding. Valid options are `8bit' (default) or `utf8'." .ie n .IP "\fB\-X \-\-expansion=\f(CB""NUMBER""\fB\fR set parser behaviour according to the bits of ""NUMBER""" 2 .el .IP "\fB\-X \-\-expansion=\f(CBNUMBER\fB\fR set parser behaviour according to the bits of \f(CWNUMBER\fR" 2 .IX Item "-X --expansion=NUMBER set parser behaviour according to the bits of NUMBER" .PD .PP \&\s-1NUMBER\s0 is a combination of .IP "\fB1\fR do not parse unknown tags" 2 .IX Item "1 do not parse unknown tags" .PD 0 .IP "\fB2\fR unknown tags are assumed being simple" 2 .IX Item "2 unknown tags are assumed being simple" .IP "\fB4\fR trailing star in tag name do not make this tag simple" 2 .IX Item "4 trailing star in tag name do not make this tag simple" .IP "\fB8\fR an unmatched end tag closes all previous unmatched begin tags" 2 .IX Item "8 an unmatched end tag closes all previous unmatched begin tags" .IP "\fB16\fR interpret backslashes as printf" 2 .IX Item "16 interpret backslashes as printf" .IP "\fB32\fR remove trailing slash in tag attributes" 2 .IX Item "32 remove trailing slash in tag attributes" .IP "\fB64\fR do not remove trailing star in tag name" 2 .IX Item "64 do not remove trailing star in tag name" .IP "\fB128\fR do not remove leading star in tag name" 2 .IX Item "128 do not remove leading star in tag name" .IP "\fB256\fR do not add a space before trailing slash in tag attributes" 2 .IX Item "256 do not add a space before trailing slash in tag attributes" .IP "\fB1024\fR suppress warnings about bad nested tags" 2 .IX Item "1024 suppress warnings about bad nested tags" .IP "\fB2048\fR suppress warnings about missing trailing slash" 2 .IX Item "2048 suppress warnings about missing trailing slash" .PD .PP In version 1.3.1, default value is 3114=2+8+32+1024+2048. .SS "Limits control" .IX Subsection "Limits control" .ie n .IP "\fB\-H \-\-hashsize=\f(CB""PRIME""\fB\fR set symbol lookup hash table size (default 509)" 2 .el .IP "\fB\-H \-\-hashsize=\f(CBPRIME\fB\fR set symbol lookup hash table size (default 509)" 2 .IX Item "-H --hashsize=PRIME set symbol lookup hash table size (default 509)" .PD 0 .ie n .IP "\fB\-L \-nesting\-limit=\f(CB""NUMBER""\fB\fR change artificial nesting limit (default 250)" 2 .el .IP "\fB\-L \-nesting\-limit=\f(CBNUMBER\fB\fR change artificial nesting limit (default 250)" 2 .IX Item "-L -nesting-limit=NUMBER change artificial nesting limit (default 250)" .PD .SS "Debugging" .IX Subsection "Debugging" .ie n .IP "\fB\-d \-\-debug=\f(CB""FLAGS""\fB\fR set debug level (no \s-1FLAGS\s0 implies `aeq')" 2 .el .IP "\fB\-d \-\-debug=\f(CBFLAGS\fB\fR set debug level (no \s-1FLAGS\s0 implies `aeq')" 2 .IX Item "-d --debug=FLAGS set debug level (no FLAGS implies `aeq')" .PD 0 .ie n .IP "\fB\-t \-\-trace=\f(CB""NAME""\fB\fR trace \s-1NAME\s0 when it will be defined" 2 .el .IP "\fB\-t \-\-trace=\f(CBNAME\fB\fR trace \s-1NAME\s0 when it will be defined" 2 .IX Item "-t --trace=NAME trace NAME when it will be defined" .ie n .IP "\fB\-l \-\-arglength=\f(CB""NUMBER""\fB\fR restrict macro tracing size" 2 .el .IP "\fB\-l \-\-arglength=\f(CBNUMBER\fB\fR restrict macro tracing size" 2 .IX Item "-l --arglength=NUMBER restrict macro tracing size" .ie n .IP "\fB\-o \-\-error\-output=\f(CB""FILE""\fB\fR redirect debug and trace output" 2 .el .IP "\fB\-o \-\-error\-output=\f(CBFILE\fB\fR redirect debug and trace output" 2 .IX Item "-o --error-output=FILE redirect debug and trace output" .PD .PP Flags are any of: .IP "\fBt\fR trace for all macro calls, not only debugging-on'ed" 2 .IX Item "t trace for all macro calls, not only debugging-on'ed" .PD 0 .IP "\fBa\fR show actual arguments" 2 .IX Item "a show actual arguments" .IP "\fBe\fR show expansion" 2 .IX Item "e show expansion" .IP "\fBc\fR show before collect, after collect and after call" 2 .IX Item "c show before collect, after collect and after call" .IP "\fBx\fR add a unique macro call id, useful with c flag" 2 .IX Item "x add a unique macro call id, useful with c flag" .IP "\fBf\fR say current input file name" 2 .IX Item "f say current input file name" .IP "\fBl\fR say current input line number" 2 .IX Item "l say current input line number" .IP "\fBp\fR show results of path searches" 2 .IX Item "p show results of path searches" .IP "\fBm\fR show results of module operations" 2 .IX Item "m show results of module operations" .IP "\fBi\fR show changes in input files" 2 .IX Item "i show changes in input files" .IP "\fBV\fR shorthand for all of the above flags" 2 .IX Item "V shorthand for all of the above flags" .PD .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \fBmp4h\fR software is a macro-processor, which means that keywords are replaced by other text. This chapter describes all primitives. As \fBmp4h\fR has been specially designed for \s-1HTML\s0 documents, its syntax is very similar to \s-1HTML,\s0 with tags and attributes. One important feature has no equivalent in \s-1HTML:\s0 comments until end of line. All text following three colons is discarded until end of line, like .PP .Vb 1 \& ;;; This is a comment .Ve .SS "Function Macros" .IX Subsection "Function Macros" \&\fBNote:\fR All examples in this documentation are processed through \fBmp4h\fR with expansion flags set to zero (see a description of possible expansion flags at the end of document), it is why simple tags contain a trailing slash. But \fBmp4h\fR can output plain \s-1HTML\s0 files with other expansion flags. .PP The definition of new tags is the most common task provided by \fBmp4h\fR. As with \s-1HTML,\s0 macro names are case insensitive, unless \f(CW\*(C`\-c\*(C'\fR option is used to change this default behaviour. In this documentation, only lowercase letters are used. There are two kinds of tags: simple and complex. A simple tag has the following form: .PP .Vb 1 \& .Ve .PP whereas a complex tag looks like: .PP .Vb 3 \& \& body \& .Ve .PP Since version 0.9.1, \fBmp4h\fR knows \s-1XHTML\s0 syntax too, so your input file may conform to \s-1HTML\s0 or \s-1XHTML\s0 syntax. In this manual, we adopt the latter, which is why simple tags have a trailing slash in attributes. If you want to produce \s-1HTML\s0 files with this input file, you may either choose an adequate \f(CW\*(C`\-\-expansion\*(C'\fR flag or use a post-processor like tidy \f(CW\*(C`\*(C'\fR. .PP When a simple tag is defined by \fBmp4h\fR, it can be parsed even if the trailing slash is omitted, because \fBmp4h\fR knows that this tag is simple. But it is a good practice to always append a trailing slash to simple tags. .PP In macro descriptions below, a slash indicates a simple tag, and a V letter that attributes are read verbatim (without expansion) (see the chapter on macro expansion for further details). .IP "\(bu" 2 define-tag .Sp \&\f(CW\*(C`\f(CIname\f(CW\*(C'\fR \f(CW\*(C`[attributes=verbatim]\*(C'\fR \f(CW\*(C`[endtag=required]\*(C'\fR \f(CW\*(C`[whitespace=delete]\*(C'\fR .PP This function lets you define your own tags. First argument is the command name. Replacement text is the function body. .PP Source: .PP .Vb 2 \& bar \& .Ve .PP Output: .PP .Vb 1 \& bar .Ve .PP Even if spaces have usually few incidence on \s-1HTML\s0 syntax, it is important to note that .PP .Vb 1 \& bar .Ve .PP and .PP .Vb 3 \& \& bar \& .Ve .PP are not equivalent, the latter form contains two newlines that were not present in the former. .ie n .IP """whitespace=delete""" 4 .el .IP "\f(CWwhitespace=delete\fR" 4 .IX Item "whitespace=delete" Some spaces are suppressed in replacement text, in particular any leading or trailing spaces, and newlines not enclosed within angle brackets. .ie n .IP """endtag=required""" 4 .el .IP "\f(CWendtag=required\fR" 4 .IX Item "endtag=required" Define a complex tag .Sp Source: .Sp .Vb 2 \& bar \& .Ve .Sp Output: .Sp .Vb 1 \& bar .Ve .Sp Source: .Sp .Vb 3 \& ;;; \& body is: %body \& Here it is .Ve .Sp Output: .Sp .Vb 1 \& body is: Here it is .Ve .ie n .IP """attributes=verbatim""" 4 .el .IP "\f(CWattributes=verbatim\fR" 4 .IX Item "attributes=verbatim" By default attributes are expanded before text is replaced. If this attribute is used, attributes are inserted into replacement text without expansion. .Sp Source: .Sp .Vb 6 \& quux \& \& Body: %Ubody \& Attributes: %Uattributes \& \& Here we go .Ve .Sp Output: .Sp .Vb 2 \& Body: Here we go \& Attributes: txt= .Ve .IP "\(bu" 2 provide-tag .Sp \&\f(CW\*(C`\f(CIname\f(CW\*(C'\fR \f(CW\*(C`[attributes=verbatim]\*(C'\fR \f(CW\*(C`[endtag=required]\*(C'\fR \f(CW\*(C`[whitespace=delete]\*(C'\fR .PP This command is similar to the previous one, except that no operation is performed if this command was already defined. .IP "\(bu" 2 let \f(CW\*(C`S\*(C'\fR .Sp \&\f(CW\*(C`\f(CInew\f(CW=\f(CIold\f(CW\*(C'\fR .PP Copy a function. This command is useful to save a macro definition before redefining it. .PP Source: .PP .Vb 4 \& one \& \& two \& .Ve .PP Output: .PP .Vb 1 \& twoone .Ve .IP "\(bu" 2 undef \f(CW\*(C`S\*(C'\fR .Sp \&\f(CW\*(C`\f(CIname\f(CW\*(C'\fR .PP Delete a command definition. .PP Source: .PP .Vb 3 \& one \& \& .Ve .PP Output: .PP .Vb 1 \& .Ve .IP "\(bu" 2 set-hook .Sp \&\f(CW\*(C`\f(CIname\f(CW\*(C'\fR \f(CW\*(C`[position=before|after]\*(C'\fR \f(CW\*(C`[action=insert|append|replace]\*(C'\fR .PP Add text to a predefined macro. This mechanism allows modifications of existing macros without having to worry about its type, whether it is complex or not. .PP Source: .PP .Vb 6 \& \& \& Before \& \& After \& .Ve .PP Output: .PP .Vb 2 \& Before10 \& After .Ve .IP "\(bu" 2 get-hook \f(CW\*(C`S\*(C'\fR .Sp \&\f(CW\*(C`\f(CIname\f(CW\*(C'\fR \f(CW\*(C`[position=before|after]\*(C'\fR .PP Print current hooks of a macro. .PP Source: .PP .Vb 2 \& Text inserted with position=before:! \& Text inserted with position=after:! .Ve .PP Output: .PP .Vb 4 \& Text inserted with position=before: \& Before! \& Text inserted with position=after: \& After! .Ve .IP "\(bu" 2 attributes-quote \f(CW\*(C`S\*(C'\fR .Sp \&\f(CW\*(C`\f(CW%attributes\f(CW\*(C'\fR .PP Like \f(CW%attributes\fR, except that \f(CW\*(C`attr=value\*(C'\fR pairs are printed with double quotes surrounding attribute values, and a leading space is added if some text is printed. .PP Source: .PP .Vb 6 \& ;;; \& %attributes \& /> \& \&