"Fossies" - the Fresh Open Source Software Archive

Member "tidy-html5-5.8.0/man/tidy1.xsl.in" (16 Jul 2021, 17533 Bytes) of package /linux/www/tidy-html5-5.8.0.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "tidy1.xsl.in": 5.7.28_vs_5.8.0.

    1 <?xml version="1.0"?>
    2 <!--
    3   For generating the `tidy.1` man page from the
    4   output of `tidy -xml-help` and `tidy -xml-config`
    5 
    6   (c) 2005-2017 (W3C) MIT, ERCIM, Keio University
    7   See tidy.h for the copyright notice.
    8 
    9   Written by Jelks Cabaniss and Arnaud Desitter
   10 -->
   11 <xsl:stylesheet version="1.0"
   12                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   13 
   14 <xsl:strip-space elements="description" />
   15 
   16 <xsl:output method="text" />
   17 
   18 <!--
   19   The default template match is to the document passed on the
   20   command line to the XSLT processor, currently "tidy-help.xml".
   21   For the detailed config options section however, the template
   22   match is to the file "tidy-config.xml".  This is captured in
   23   the $CONFIG variable, declared here. CMAKE configure will
   24   substitute TIDYCONFIG during the build. Shell scripts will
   25   have to do the same.
   26 -->
   27 
   28 <xsl:variable name="CONFIG" select="document('@TIDYCONFIG@')"/>
   29 <xsl:variable name="ENABLE_CONFIG_FILES" select="'@ENABLE_CONFIG_FILES@'"/>
   30 <xsl:variable name="TIDY_CONFIG_FILE" select="'@TIDY_CONFIG_FILE@'"/>
   31 <xsl:variable name="TIDY_USER_CONFIG_FILE" select="'@TIDY_USER_CONFIG_FILE@'"/>
   32 
   33 <!-- Main Template: -->
   34 <xsl:template match="/">
   35   <xsl:call-template name="header-section" />
   36   <xsl:call-template name="cmdline-section" />
   37   <xsl:call-template name="manpage-see-also-section" />
   38 </xsl:template>
   39 
   40 <!-- Named Templates: -->
   41 
   42 <xsl:template name="header-section">
   43   <xsl:text/>.\" tidy man page for the HTML Tidy
   44 .TH TIDY 1 "<xsl:value-of select="cmdline/@version" />" "HTML Tidy" "<xsl:value-of select="cmdline/@version" />"
   45 </xsl:template>
   46 
   47 <xsl:template name="cmdline-section">
   48 .\" disable hyphenation
   49 .nh
   50 .\" disable justification (adjust text to left margin only)
   51 .ad l
   52 .SH NAME
   53 \fBtidy\fR - check, correct, and pretty-print HTML(5) files
   54 .SH SYNOPSIS
   55 \fBtidy\fR [\fIoptions\fR] [\fIfile\fR ...] [\fIoptions\fR] [\fIfile\fR ...] ...
   56 .SH DESCRIPTION
   57 Tidy reads HTML, XHTML, and XML files and writes cleaned-up markup.  
   58 For HTML variants, it detects, reports, and corrects many common coding errors
   59 and strives to produce visually equivalent markup that is both conformant
   60 to the HTML specifications and that works in most browsers.
   61 .LP
   62 A common use of Tidy is to convert plain HTML to XHTML.  
   63 For generic XML files, Tidy is limited to correcting basic well-formedness
   64 errors and pretty printing.
   65 .LP
   66 If no input file is specified, Tidy reads the standard input.  
   67 If no output file is specified, Tidy writes the tidied markup to the
   68 standard output.  If no error file is specified, Tidy writes messages
   69 to the standard error.
   70 .SH OPTIONS
   71 Tidy supports two different kinds of options.  
   72 Purely \fIcommand-line\fR options, starting with a single dash '\fB-\fR',
   73 can only be used on the command-line, not in configuration files.  
   74 They are listed in the first part of this section.  
   75 \fIConfiguration\fR options, on the other hand, can either be passed
   76 on the command line, starting with two dashes \fB--\fR,
   77 or specified in a configuration file,
   78 using the option name, followed by a colon \fB:\fR, plus the value, without 
   79 the starting dashes. They are listed in the second part of this section,
   80 with a sample config file.
   81 .LP
   82 For \fIcommand-line\fR options that expect a numerical argument,
   83 a default is assumed if no meaningful value can be found.  
   84 On the other hand, \fIconfiguration\fR options cannot be used
   85 without a value; a \fIconfiguration\fR option without a value
   86 is simply discarded and reported as an error.
   87 .LP
   88 Using a \fIcommand-line\fR option is sometimes equivalent to setting
   89 the value of a \fIconfiguration\fR option.  The equivalent option
   90 and value are shown in parentheses in the list below, as they would
   91 appear in a configuration file.  For example,
   92 \fB-quiet, -q\fR (\fIquiet: yes\fR) means that using the
   93 \fIcommand-line\fR option \fB-quiet\fR or \fB-q\fR
   94 is equivalent to setting the \fIconfiguration\fR option
   95 \fIquiet\fR to \fIyes\fR.
   96 .LP
   97 Single-letter \fIcommand-line\fR options without an associated value
   98 can be combined; for example '\fB-i\fR', '\fB-m\fR' and '\fB-u\fR'
   99 may be combined as '\fB-imu\fR'.<xsl:text/>
  100 <xsl:call-template name="show-cmdline-options" />
  101 .SS Configuration Options General
  102 .rs
  103 .LP
  104 \fIConfiguration\fR options can be specified
  105 by preceding each option with \fB--\fR at the command line,
  106 followed by its desired value,
  107 OR by placing the options and values in a configuration file,
  108 and telling tidy to read that file with the \fB-config\fR option:
  109 .LP
  110 .in 1i
  111 \fBtidy --\fR\fIoption1 \fRvalue1 \fB--\fIoption2 \fRvalue2 ...
  112 .br
  113 \fBtidy -config \fIconfig-file \fR ...
  114 .LP
  115 \fIConfiguration\fR options can be conveniently grouped
  116 in a single config file.  
  117 A Tidy configuration file is simply a text file, where each option
  118 is listed on a separate line in the form
  119 .LP
  120 .in 1i
  121 \fIoption1\fR: \fIvalue1\fR
  122 .br
  123 \fIoption2\fR: \fIvalue2\fR
  124 .br
  125 etc.
  126 .LP
  127 The permissible values for a given option depend on the option's Type.  
  128 There are five Types: \fIBoolean\fR, \fIAutoBool\fR, \fIDocType\fR,
  129 \fIEnum\fR, and \fIString\fR.  
  130 \fIBoolean\fR Types allow any of \fByes/no, y/n, true/false, t/f, 1/0\fR.  
  131 \fIAutoBool\fRs allow \fBauto\fR in addition to the values allowed
  132 by \fIBooleans\fR.  
  133 \fIInteger\fR Types take non-negative integers.  
  134 \fIString\fR Types generally have no defaults, and you should provide them in
  135 non-quoted form (unless you wish the output to contain the literal quotes).
  136 .LP
  137 \fIEnum\fR, \fIEncoding\fR, and \fIDocType\fR Types have a fixed repertoire
  138 of items, which are listed in the \fISupported values\fR sections below.
  139 .LP
  140 You only need to provide options and values for those whose defaults you wish
  141 to override, although you may wish to include some already-defaulted options
  142 and values for the sake of documentation and explicitness.
  143 .LP
  144 Here is a sample config file, with at least one example of each of
  145 the five Types:
  146 .LP
  147     \fI// sample Tidy configuration options
  148     output-xhtml: yes
  149     add-xml-decl: no
  150     doctype: strict
  151     char-encoding: ascii
  152     indent: auto
  153     wrap: 76
  154     repeated-attributes: keep-last
  155     error-file: errs.txt
  156 \fR
  157 .LP
  158 Below is a summary and brief description of each of the options.  
  159 They are listed alphabetically within each category.<xsl:text/>
  160 <xsl:call-template name="show-config-options" />
  161 .SH ENVIRONMENT
  162 .TP
  163 .B HTML_TIDY
  164 Name of the default configuration file.  This should be an absolute path,
  165 since you will probably invoke \fBtidy\fR from different directories.  
  166 The value of HTML_TIDY will be parsed after the compiled-in default
  167 (defined with -DTIDY_CONFIG_FILE), but before any of the files specified
  168 using \fB-config\fR.
  169 <xsl:if test="$ENABLE_CONFIG_FILES = 'ON'">
  170 .TP
  171 .B RUNTIME CONFIGURATION FILES
  172 You can also specify runtime configuration files from which \fBtidy\fR will
  173 attempt to load a configuration automatically.
  174 .IP
  175 The system runtime configuration file (<xsl:value-of select="$TIDY_CONFIG_FILE" />),
  176 if it exists will be loaded and applied first, followed by the user runtime
  177 configuration file (<xsl:value-of select="$TIDY_USER_CONFIG_FILE" />).
  178 Subsequent usage of a specific option will override any previous usage.
  179 .IP
  180 Note that if you use the \fBHTML_TIDY\fR environment variable, then the user
  181 runtime configuration file will not be used. This is a feature, not a bug.
  182 </xsl:if>
  183 .SH "EXIT STATUS"
  184 .IP 0
  185 All input files were processed successfully.
  186 .IP 1
  187 There were warnings.
  188 .IP 2
  189 There were errors.
  190 </xsl:template>
  191 
  192 <xsl:template name="show-cmdline-options">
  193 .SS File manipulation
  194   <xsl:call-template name="cmdline-detail">
  195     <xsl:with-param name="category">file-manip</xsl:with-param>
  196   </xsl:call-template>
  197 .SS Processing directives
  198   <xsl:call-template name="cmdline-detail">
  199     <xsl:with-param name="category">process-directives</xsl:with-param>
  200   </xsl:call-template>
  201 .SS Character encodings
  202   <xsl:call-template name="cmdline-detail">
  203     <xsl:with-param name="category">char-encoding</xsl:with-param>
  204   </xsl:call-template>
  205 .SS Miscellaneous
  206   <xsl:call-template name="cmdline-detail">
  207     <xsl:with-param name="category">misc</xsl:with-param>
  208   </xsl:call-template>
  209 .SS XML
  210   <xsl:call-template name="cmdline-detail">
  211     <xsl:with-param name="category">xml</xsl:with-param>
  212   </xsl:call-template>
  213 </xsl:template>
  214 
  215 <xsl:template name="cmdline-detail">
  216 <!--
  217   For each option in one of the categories/classes, provide its
  218     1. names
  219     2. description
  220     3. equivalent configuration option
  221 -->
  222   <xsl:param name="category" />
  223   <xsl:for-each select='/cmdline/option[@class=$category]'>
  224 <xsl:text>
  225 .TP
  226 </xsl:text>
  227     <xsl:call-template name="process-names" />
  228     <xsl:call-template name="process-eqconfig" />
  229     <xsl:text>
  230 </xsl:text>
  231     <xsl:apply-templates select="description" />
  232   </xsl:for-each>
  233 </xsl:template>
  234 
  235 <!-- Used only in the cmdline section -->
  236 <xsl:template name="process-names">
  237   <xsl:for-each select="name">
  238     <xsl:text />\fB<xsl:value-of select="." />\fR<xsl:text />
  239     <xsl:if test="position() != last()">
  240       <xsl:text>, </xsl:text>
  241     </xsl:if>
  242   </xsl:for-each>
  243 </xsl:template>
  244 
  245 <!-- Used only in the cmdline section -->
  246 <xsl:template name="process-eqconfig">
  247   <xsl:if test="string-length(eqconfig) &gt; 0">
  248     <xsl:for-each select="eqconfig">
  249       <xsl:text> (\fI</xsl:text>
  250       <xsl:value-of select="." />
  251       <xsl:text>\fR)</xsl:text>
  252     </xsl:for-each>
  253   </xsl:if>
  254 </xsl:template>
  255 
  256 <xsl:template name="show-config-options">
  257 .SS Document Display options<xsl:text/>
  258   <xsl:call-template name="config-detail">
  259     <xsl:with-param name="category">TidyDisplay</xsl:with-param>
  260   </xsl:call-template>
  261 .SS Document In and Out options
  262   <xsl:call-template name="config-detail">
  263     <xsl:with-param name="category">TidyDocumentIO</xsl:with-param>
  264   </xsl:call-template>
  265 .SS File Input-Output options
  266   <xsl:call-template name="config-detail">
  267     <xsl:with-param name="category">TidyFileIO</xsl:with-param>
  268   </xsl:call-template>
  269 .SS Diagnostics options
  270   <xsl:call-template name="config-detail">
  271     <xsl:with-param name="category">TidyDiagnostics</xsl:with-param>
  272   </xsl:call-template>
  273 .SS Encoding options
  274   <xsl:call-template name="config-detail">
  275     <xsl:with-param name="category">TidyEncoding</xsl:with-param>
  276   </xsl:call-template>
  277 .SS Cleanup options
  278   <xsl:call-template name="config-detail">
  279     <xsl:with-param name="category">TidyMarkupCleanup</xsl:with-param>
  280   </xsl:call-template>
  281 .SS Entities options
  282   <xsl:call-template name="config-detail">
  283     <xsl:with-param name="category">TidyMarkupEntities</xsl:with-param>
  284   </xsl:call-template>
  285 .SS Repair options
  286   <xsl:call-template name="config-detail">
  287     <xsl:with-param name="category">TidyMarkupRepair</xsl:with-param>
  288   </xsl:call-template>
  289 .SS Transformation options
  290   <xsl:call-template name="config-detail">
  291     <xsl:with-param name="category">TidyMarkupXForm</xsl:with-param>
  292   </xsl:call-template>
  293 .SS Teaching Tidy options
  294   <xsl:call-template name="config-detail">
  295     <xsl:with-param name="category">TidyMarkupTeach</xsl:with-param>
  296   </xsl:call-template>
  297 .SS Pretty Print options
  298   <xsl:call-template name="config-detail">
  299     <xsl:with-param name="category">TidyPrettyPrint</xsl:with-param>
  300   </xsl:call-template>
  301 </xsl:template>
  302 
  303 
  304 <!--
  305   Note that any templates called implicitly or explicitly
  306   from the "config-detail" template below will match on
  307   the document referred to by the $CONFIG variable, i.e.,
  308   the file "tidy-config.xml", created by running
  309 
  310       tidy -xml-config > tidy-config.xml
  311 
  312   The $CONFIG variable is set at the top level of this
  313   stylesheet.
  314 -->
  315 
  316 <xsl:template name="config-detail">
  317 <!--
  318   For each option in one of the 5 categories/classes, provide its
  319     1. name
  320     2. Type
  321     3. default (if any)
  322     4. example (if any)
  323     5. description
  324     6. seealso (if any)
  325 -->
  326   <xsl:param name="category" />
  327 .rs<xsl:text/>
  328   <xsl:for-each select='$CONFIG/config/option[@class=$category]'>
  329     <xsl:sort select="name" order="ascending" />
  330 .TP
  331 <xsl:text>\fB</xsl:text>
  332   <xsl:text>--</xsl:text><xsl:apply-templates select="name" />
  333 <xsl:text>\fR</xsl:text>
  334 <xsl:text> </xsl:text>
  335 <xsl:text>\fI</xsl:text>
  336   <xsl:apply-templates select="type" />
  337 <xsl:text>\fR</xsl:text>
  338 <xsl:apply-templates select="default" />
  339 .br
  340 <xsl:apply-templates select="example" />
  341 <xsl:apply-templates select="description" />
  342 <xsl:call-template name="seealso" />
  343   </xsl:for-each>
  344 </xsl:template>
  345 
  346 <!-- Used only in the config options section: -->
  347 <xsl:template name="seealso">
  348   <xsl:if test="seealso">
  349     <xsl:text>
  350 </xsl:text>
  351 See also: <xsl:text />
  352     <xsl:for-each select="seealso">
  353       <xsl:text />\fB--<xsl:value-of select="." />\fR<xsl:text />
  354       <xsl:if test="position() != last()">
  355         <xsl:text>, </xsl:text>
  356       </xsl:if>
  357     </xsl:for-each>
  358   </xsl:if>
  359 </xsl:template>
  360 
  361 <!-- Used only in the config options section: -->
  362 <xsl:template match="default[.!='']">
  363   <xsl:text> (</xsl:text>
  364   <xsl:text>\fB</xsl:text>
  365     <xsl:value-of select="." />
  366   <xsl:text>\fR</xsl:text>
  367   <xsl:text> if unset)</xsl:text>
  368 </xsl:template>
  369 
  370 <!--
  371   Do not print redundant examples
  372   (identical for all values of the same Type)
  373 -->
  374 <xsl:template match="
  375   option[
  376     type = 'Boolean'
  377     or type = 'AutoBool'
  378     or type = 'Integer'
  379     or type = 'Tag names'
  380   ]/example" priority="2"
  381 />
  382 
  383 <!-- Used only in the config options section: -->
  384 <xsl:template match="example[.!='']">
  385   <xsl:text>Supported values: </xsl:text>
  386   <xsl:text>\fB</xsl:text>
  387     <xsl:value-of select="." />
  388   <xsl:text>\fR</xsl:text>
  389   <xsl:text>&#xA;&#xA;</xsl:text>
  390 </xsl:template>
  391 
  392 <!-- Called from the templates below matching `code`, `em`, `strong`: -->
  393 <xsl:template name="escape-backslash">
  394 <!--
  395   Since backslashes are "special" to the *roff processors used
  396   to generate man pages, we need to escape backslash characters
  397   appearing in content with another backslash.
  398 -->
  399   <xsl:choose>
  400     <xsl:when test="contains(.,'\')">
  401       <xsl:value-of select=
  402         "concat( substring-before(.,'\'), '\\', substring-after(.,'\') )" />
  403     </xsl:when>
  404     <xsl:otherwise>
  405       <xsl:apply-templates />
  406     </xsl:otherwise>
  407   </xsl:choose>
  408 </xsl:template>
  409 
  410 <!-- Appears at the bottom of the man page: -->
  411 <xsl:template name="manpage-see-also-section">
  412 .SH SEE ALSO
  413 For more information about HTML Tidy:
  414 .RS 4
  415 .LP
  416 http://www.html-tidy.org/
  417 .RE
  418 .LP
  419 For more information on HTML:
  420 .RS 4
  421 .LP
  422 \fBHTML: Edition for Web Authors\fR (the latest HTML specification)
  423 .br
  424 http://dev.w3.org/html5/spec-author-view
  425 .LP
  426 \fBHTML: The Markup Language\fR (an HTML language reference)
  427 .br
  428 http://dev.w3.org/html5/markup/
  429 .RE
  430 .LP
  431 For bug reports and comments:
  432 .RS 4
  433 .LP
  434 https://github.com/htacg/tidy-html5/issues/
  435 .RE
  436 .LP
  437 Or send questions and comments to \fBpublic-htacg@w3.org\fR.
  438 .LP
  439 Validate your HTML documents using the \fBW3C Nu Markup Validator\fR:
  440 .RS 4
  441 .LP
  442 http://validator.w3.org/nu/
  443 .RE
  444 .SH AUTHOR
  445 \fBTidy\fR was written by \fBDave Raggett\fR &lt;dsr@w3.org&gt;,
  446 and subsequently maintained by a team at http://tidy.sourceforge.net/,
  447 and now maintained by \fBHTACG\fR (http://www.htacg.org).
  448 .LP
  449 The sources for \fBHTML Tidy\fR are available at
  450 https://github.com/htacg/tidy-html5/ under the MIT Licence.
  451 </xsl:template>
  452 
  453 <!-- Regular Templates: -->
  454 
  455 <xsl:template match="description">
  456   <xsl:apply-templates />
  457 </xsl:template>
  458 
  459 <xsl:template match="a">
  460   <xsl:apply-templates />
  461   <xsl:text /> at \fI<xsl:value-of select="@href" />\fR<xsl:text />
  462 </xsl:template>
  463 
  464 <xsl:template match="code | em">
  465   <xsl:text>\fI</xsl:text>
  466     <xsl:call-template name="escape-backslash" />
  467   <xsl:text>\fR</xsl:text>
  468 </xsl:template>
  469 
  470 <xsl:template match="var">
  471   <xsl:text>\fB</xsl:text>
  472     <xsl:call-template name="escape-backslash" />
  473   <xsl:text>\fR</xsl:text>
  474 </xsl:template>
  475 
  476 <xsl:template match="p[1]">
  477   <xsl:text>
  478 .sp 1
  479 </xsl:text>
  480   <xsl:text /><xsl:call-template name="escape-backslash" />
  481 </xsl:template>
  482 
  483 <xsl:template match="p[position() != 1]">
  484   <xsl:text>
  485 .sp 1
  486 </xsl:text>
  487   <xsl:text /><xsl:call-template name="escape-backslash" />
  488   <xsl:text>
  489 .sp 1
  490 </xsl:text>
  491 </xsl:template>
  492 
  493 <xsl:template match="br">
  494   <xsl:text>
  495 .sp 1
  496 </xsl:text>
  497 </xsl:template>
  498 
  499 <xsl:template match="strong">
  500   <xsl:text />\fB<xsl:call-template name="escape-backslash" />\fR<xsl:text />
  501 </xsl:template>
  502 
  503 <!--
  504   The following templates
  505     a) normalize whitespace, primarily necessary for `description`
  506     b) do so without stripping possible whitespace surrounding `code`
  507     d) strip leading and trailing whitespace in 'description` and `code`
  508   (courtesy of Ken Holman on the XSL-list):
  509 -->
  510 
  511 <xsl:template match="text()[preceding-sibling::node() and
  512                              following-sibling::node()]">
  513   <xsl:variable name="ns" select="normalize-space(concat('x',.,'x'))"/>
  514   <xsl:value-of select="substring( $ns, 2, string-length($ns) - 2 )" />
  515 </xsl:template>
  516 
  517 <xsl:template match="text()[preceding-sibling::node() and
  518                              not( following-sibling::node() )]">
  519   <xsl:variable name="ns" select="normalize-space(concat('x',.))"/>
  520   <xsl:value-of select="substring( $ns, 2, string-length($ns) - 1 )" />
  521 </xsl:template>
  522 
  523 <xsl:template match="text()[not( preceding-sibling::node() ) and
  524                              following-sibling::node()]">
  525   <xsl:variable name="ns" select="normalize-space(concat(.,'x'))"/>
  526   <xsl:value-of select="substring( $ns, 1, string-length($ns) - 1 )" />
  527 </xsl:template>
  528 
  529 <xsl:template match="text()[not( preceding-sibling::node() ) and
  530                              not( following-sibling::node() )]">
  531   <xsl:value-of select="normalize-space(.)"/>
  532 </xsl:template>
  533 
  534 </xsl:stylesheet>