Merge pull request #182 from pedromorgan/pedro2

Docs missing bits - Pedro2
This commit is contained in:
Jim Derry 2015-03-08 13:47:08 +08:00
commit 08fb836a1d
22 changed files with 1231 additions and 179 deletions

12
build/documentation/.gitignore vendored Normal file
View file

@ -0,0 +1,12 @@
# file created during build_docs
# = tidy5 -h > tidy5.cmd.txt
examples/tidy5.*.txt
# The license file needs to copies to examples for \include
examples/LICENSE.md
# file generates from xsl
examples/quickref_include.html

View file

@ -3,7 +3,6 @@
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="yes" title="Tidy Home"/>
<tab type="user" url="quickref.html" title="Quick Ref"/>
<tab type="pages" visible="yes" title="Pages" intro=""/>
<tab type="modules" visible="yes" title="" intro=""/>
<tab type="namespaces" visible="yes" title="">
@ -21,6 +20,7 @@
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro=""/>
<tab type="user" url="https://github.com/htacg/tidy-html5/issues" title="Bugs &amp; Issues"/>
<tab type="user" url="https://github.com/htacg/tidy-html5" title="github"/>
<tab type="user" url="http://www.htacg.org/" title="htacg.org"/>
<tab type="user" url="http://www.html-tidy.org/" title="html-tidy.org"/>

View file

@ -1,4 +1,8 @@
# Documentation HOWTO
Documentation HOWTO {#docs_howto}
========================
Instructions for generating documentation
\note For linking to these docs, the doxygen tag file is `tidy.tags`
**HTML Tidy** provides several types of documentation to suit different purposes. This
document describes how to generate the following:

View file

@ -7,7 +7,7 @@
# documentation. Relative path is okay. You shouldn't have to change this
# too often if your compiler always puts tidy in the same place.
TIDY_PATH="./tidy5" # Current directory.
TIDY_PATH="../cmake/tidy5" # Current directory.
TIDY_VERSION=`cat ../../version.txt`
@ -71,6 +71,7 @@ if [ "$BUILD_XSLT" -eq 1 ]; then
# 'quickref.html'
xsltproc "quickref.xsl" "tidy-config.xml" > "$OUTP_DIR/quickref.html"
xsltproc "quickref.include.xsl" "tidy-config.xml" > ./examples/quickref_include.html
# 'tidy.1'
xsltproc "tidy1.xsl" "tidy-help.xml" > "$OUTP_DIR/tidy.1"
@ -108,16 +109,35 @@ if [ "$BUILD_API" -eq 1 ]; then
echo "The following is doxygen's stderr output. It doesn't indicate errors with this script:\n"
# echo the output of tidy5 --help so we can include
$TIDY_PATH -h > "./$OUTP_DIR/tidy5.cmd.txt"
$TIDY_PATH -h > "./examples/tidy5.help.txt"
$TIDY_PATH -help-config > "./examples/tidy5.config.txt"
## copy license file to examples for includsing
cp ../../LICENSE.md ./examples/
## this lot
# - echos and catches outputs the doxygen config
# - overwrites some vars but appending some to config an end
# - which are then passed to doxygen as stdin (instead of the path to a config.file)
( cat "$DOXY_CFG"; \
echo "PROJECT_NUMBER=$TIDY_VERSION"; \
echo "HTML_EXTRA_FILES=$OUTP_DIR/quickref.html ./$OUTP_DIR/tidy5.cmd.txt"; ) \
echo "PROJECT_NUMBER=$TIDY_VERSION"; \
echo "GENERATE_TAGFILE=$OUTP_DIR/tidylib_api/tidy.tags"; \
echo "HTML_EXTRA_FILES= ./examples/tidy5.help.txt ./examples/tidy5.config.txt"; ) \
| doxygen - > /dev/null
# cleanup
rm "./examples/tidy5.help.txt"
rm "./examples/tidy5.config.txt"
rm "./examples/LICENSE.md"
## create zip file of docs
cd $OUTP_DIR;
#zip -r "tidy-docs-$TIDY_VERSION.zip" ./tidylib_api
echo "\nTidyLib API documentation has been built."
else
echo "* $OUTP_DIR/tidylib_api/ was skipped because not all dependencies were satisfied."

View file

@ -32,7 +32,7 @@ PROJECT_NAME = "HTML Tidy"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 4.9.15
PROJECT_NUMBER = version.txt
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
@ -120,7 +120,7 @@ ALWAYS_DETAILED_SEC = YES
# members were ordinary class members. Constructors, destructors and assignment
# operators of the base classes will not be shown.
INLINE_INHERITED_MEMB = NO
INLINE_INHERITED_MEMB = YES
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set
@ -355,7 +355,7 @@ EXTRACT_ALL = YES
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = YES
EXTRACT_PRIVATE = NO
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or
# internal scope will be included in the documentation.
@ -665,7 +665,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = "../../include" "./"
INPUT = "../../include" "./" "./pages"
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@ -724,7 +724,8 @@ EXCLUDE_SYMBOLS =
# directories that contain example code fragments that are included (see
# the \include command).
EXAMPLE_PATH = "./" "./temp/"
EXAMPLE_PATH = "./examples/"
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
@ -953,7 +954,7 @@ HTML_STYLESHEET =
# standard style sheet and is therefore more robust against future updates.
# Doxygen will copy the style sheet files to the output directory.
HTML_EXTRA_STYLESHEET =
HTML_EXTRA_STYLESHEET = ./style.css
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@ -1265,7 +1266,7 @@ MATHJAX_CODEFILE =
# typically be disabled. For large projects the javascript based search engine
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
SEARCHENGINE = NO
SEARCHENGINE = YES
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a PHP enabled web server instead of at the web client
@ -1609,7 +1610,7 @@ SEARCH_INCLUDES = NO
# contain include files that are not input files but should be processed by
# the preprocessor.
INCLUDE_PATH =
INCLUDE_PATH = "../../src"
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
@ -1669,7 +1670,7 @@ TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create
# a tag file that is based on the input files it reads.
GENERATE_TAGFILE =
GENERATE_TAGFILE =
# If the ALLEXTERNALS tag is set to YES all external classes will be listed
# in the class index. If set to NO only the inherited external classes

View file

@ -0,0 +1,22 @@
// sample config file for HTML tidy
indent: auto
indent-spaces: 2
wrap: 72
markup: yes
output-xml: no
input-xml: no
show-warnings: yes
numeric-entities: yes
quote-marks: yes
quote-nbsp: yes
quote-ampersand: no
break-before-br: no
uppercase-tags: no
uppercase-attributes: no
char-encoding: latin1
new-inline-tags: cfif, cfelse, math, mroot,
mrow, mi, mn, mo, msqrt, mfrac, msubsup, munderover,
munder, mover, mmultiscripts, msup, msub, mtext,
mprescripts, mtable, mtr, mtd, mth
new-blocklevel-tags: cfoutput, cfquery
new-empty-tags: cfelse

View file

@ -0,0 +1,52 @@
/*!
\mainpage Tidy home
\note The repository <a href="https://github.com/htacg/tidy-html5">github.com/htacg/tidy-html5</a> and this documentation should be considered canonical for HTML Tidy as of 2015-January-15. See \ref history
\b Tidy corrects and cleans up HTML content by fixing markup errors such as mismatched, misnested and missing tags, missing end "/" tags, missing quotations et all, eg:
\code{.html}
<h1><hr>heading</h1>
<h2>sub<hr>heading</h2>
<a href="#refs">References<a>
\endcode
is converted to
\code{.html}
<hr>
<h1>heading</h1>
<h2>sub</h2>
<hr>
<h2>heading</h2>
<a href="#refs">References</a>
\endcode
<h4>This project has two parts:</h4>
- \ref tidylib
- a C static or dynamic library that developers can integrate into their applications
in order to bring all of Tidys power to your favorite tools.
- \ref tidy_cmd
- a console application built on \ref tidylib for Mac OS X, Linux, Windows, UNIX, and more.
\section content Contents
- \ref quick_ref
- \ref tidy_cmd
- \ref tidy_quickstart
- \ref tidy_config
- \ref featured_options
- \ref tidy_scripting
- \ref tidylib
- <a href="modules.html">Modules</a>
- \ref building_tidy
-\ref docs_howto
- \subpage history
- \subpage license
- \ref todo
*/

View file

@ -0,0 +1,98 @@
/*!
\page building_tidy Building Tidy
How to compile and install Tidy from source code.
\tableofcontents
\section Prerequisites
- \b git - <a href="http://git-scm.com/book/en/v2/Getting-Started-Installing-Git">git-scm.com/book/en/v2/Getting-Started-Installing-Git</a>
- \b cmake - <a href="http://www.cmake.org/download/">cmake.org/download/</a>
- Appropriate build tools for the platform
CMake comes in two forms - command line and gui. Some installations only install one or the other, but sometimes both. The build
commands below are only for the command line use.
Also the actual build tools vary for each platform. But that is one of the great features of cmake, it can generate
variuous 'native' build files. Running cmake without any parameters will list the generators
available on that platform. For sure one of the common ones is "Unix Makefiles", which needs autotools
make installed, but many other generators are supported.
In windows cmake offers various versions of MSVC. Again below only the command line use of MSVC is shown, but the
tidy solution (*.sln) file can be loaded into the MSVC IDE, and the building done in there.
\section get_source Get the source code
Tidys sourcecode can be found at <a href="https://github.com/htacg/tidy-html5">github.com/htacg/tidy-html5</a>. There are sometimes
several branches, but in general `master` is the most recently updated version.
\note Note that as “cutting edge,” it may have bugs or other
unstable behavior. If you prefer a stable, officially released version, be sure to have a look
at Releases on the github page.
In general you can use the <b>Download ZIP</b> button on the github page to download the most recent version of a branch. If you prefer
Git then you can clone the repository to a working machine with:
\code{.sh}
git clone git@github.com:htacg/tidy-html5.git
\endcode
\section compile Compile
<h4>Enter the `build/cmake` directory</h4>
\code{.sh}
# *nix
cd {your-tidy-html5-directory}/build/cmake
# windows
cd {your-tidy-html5-directory}\build\cmake
\endcode
<h4>Configure the build</h4>
\code{.sh}
# *nix
cmake ../../ [-DCMAKE_INSTALL_PREFIX=/path/for/install]
# windows
cmake ..\..\
\endcode
By default cmake sets the install path to `/usr/local` in unix.
If you wanted the binary in say `/usr/bin` instead, then use `-DCMAKE_INSTALL_PREFIX=/usr`
On windows the default install is to `C:\Program Files\tidy5`, or `C:/Program Files (x86)/tidy5`, which is not very useful. After
the build the `tidy[n].exe` is in the `Release\` directory, and can be copied to any directory in your `PATH` environment variable, for global use.
If you need the tidy library built as a 'shared' (DLL) library, then in add the command `-DBUILD_SHARED_LIB:BOOL=ON`.
This option is `OFF` by default, so the static library is built and linked with the command line tool for convenience.
<h4>Compile</h4>
\code{.sh}
# *nix
make
# windows
cmake --build . --config Release
\endcode
\section compileOnstall Install
Install the applicatio and library with
\code{.sh}
# *nix
[sudo] make install
# windows
cmake --build . --config Release --target INSTALL
\endcode
*/

View file

@ -0,0 +1,146 @@
/*!
\page featured_options Featured Options
Overview of popular features and problems
\tableofcontents
\section indenting Indenting output for readability
Indenting the source markup of an HTML document makes the markup easier to read. Tidy can indent the
markup for an HTML document while recognizing elements whose contents should not be indented. In the
example below, Tidy indents the output while preserving the formatting of the `<pre>` element:
Input:
\code{.html}
<html>
<head>
<title>Test document</title>
</head>
<body>
<p>This example shows how Tidy can indent output while preserving
formatting of particular elements.</p>
<pre>This is
<em>genuine
preformatted</em>
text
</pre>
</body>
</html>
\endcode
Output:
\code{.html}
<html>
<head>
<title>Test document</title>
</head>
<body>
<p>This example shows how Tidy can indent output while preserving
formatting of particular elements.</p>
<pre>
This is
<em>genuine
preformatted</em>
text
</pre>
</body>
</html>
\endcode
Tidys indenting behavior is not perfect and can sometimes cause your output to be rendered by browsers in a different way than the input. You can
avoid unexpected indenting-related rendering problems by setting `indent:no` or `indent:auto` in a config file.
\note
<b>Preserving original indenting not possible</b><br><br>
Tidy is not capable of preserving the original indenting of the markup from the input it receives. Thats because Tidy starts by
building a clean parse tree from the input, and that parse tree doesnt contain any information about the original indenting. Tidy then
pretty-prints the parse tree using the current config settings. Trying to preserve the original
indenting from the input would interact badly with the repair operations needed to build a clean parse tree, and would considerably complicate the code.
\section encodings Encodings and character references
Tidy defaults to assuming you want output to be encoded in `UTF-8`. But Tidy offers you a choice of other
character encodings: `US ASCII`, `ISO Latin-1`, and the `ISO 2022` family of 7 bit encodings.
Tidy doesnt yet recognize the use of the HTML `<meta>` element for specifying the character encoding.
The full set of HTML character references are defined. Cleaned-up output uses named character references for characters when appropriate. Otherwise,
characters outside the normal range are output as numeric character references.
\section accessibility Accessibility
Tidy offers advice on potential accessibility problems for people using non-graphical browsers.
\section cleaning_presentational Cleaning up presentational markup
Some tools generate HTML with presentational elements such as `<font>`, `<nobr>`, and `<center>`. Tidys -clean option will replace those elements with `<style>` elements and CSS.
Some HTML documents rely on the presentational effects of `<p>` start tags that are not followed by any content. Tidy deletes
such `<p>` tags (as well as any headings that dont have content). So do not use `<p>` tags simply for
adding vertical whitespace; instead use CSS, or the `<br>` element. However, note that
Tidy wont discard `<p>` tags that are followed by any non-breaking space (that is, the \code&nbsp;\endcode named character reference).
\section new_tags Teaching Tidy about new tags
You can teach Tidy about new tags by declaring them in the configuration file, the syntax is:
\code
new-inline-tags: tag1, tag2, tag3
new-empty-tags: tag1, tag2, tag3
new-blocklevel-tags: tag1, tag2, tag3
new-pre-tags: tag1, tag2, tag3
\endcode
The same tag can be defined as \b empty and as \b inline, or as \b empty and as \b block.
These declarations can be combined to define a new empty inline or empty block element, but you are not advised to
declare tags as being both \b inline and \b block.
Note that the new tags can only appear where Tidy expects inline or block-level tags respectively. That means you cant place new
tags within the document head or other contexts with restricted content models.
\section ignoring_scripting Ignoring PHP, ASP, and JSTE instructions
Tidy will gracefully ignore many cases of PHP, ASP, and JSTE instructions within element content and as replacements for attributes,
and preserve them as-is in output; for example:
\code{.php}
<option <% if rsSchool.Fields("ID").Value
= session("sessSchoolID")
then Response.Write("selected") %>
value='<%=rsSchool.Fields("ID").Value%>'>
<%=rsSchool.Fields("Name").Value%>
(<%=rsSchool.Fields("ID").Value%>)
</option>
\endcode
But note that Tidy may report missing attributes when those are “hidden” within the PHP, ASP, or JSTE code. If you use
PHP, ASP, or JSTE code to create a start tag, but place the end tag explicitly in the HTML markup, Tidy
wont be able to match them up, and will delete the end tag. In that case you are advised to make the
start tag explicit and to use PHP, ASP, or JSTE code for just the attributes; for example:
\code{.php}
<a href="<%=random.site()%>">do you feel lucky?</a>
\endcode
Tidy can also get things wrong if the PHP, ASP, or JSTE code includes quotation marks; for example:
\code{.php}
value="<%=rsSchool.Fields("ID").Value%>"
\endcode
Tidy will see the quotation mark preceding ID as ending the attribute value, and proceed to complain about what follows.
Tidy allows you to control whether line wrapping on spaces within PHP, ASP, and JSTE instructions is
enabled; see the `wrap-php`, `wrap-asp`, and `wrap-jste` config options.
\section correcting_xml Correcting well-formedness errors in XML markup
Tidy can help you to correct well-formedness errors in XML markup. Tidy doesnt yet recognize all XML features,
though; for example, it doesnt understand CDATA sections or DTD subsets.
*/

View file

@ -0,0 +1,54 @@
/*!
\page history History
Once upon a time....
<p><strong>HTML Tidy</strong> was created by the <a href="http://www.w3.org/">W3Cs</a> own <a href="http://www.w3.org/People/Raggett/">Dave Raggett</a> back in the
dawn of the Internet age. His original Internet page is still available and
gives a sense of the early history: <a href="http://www.w3.org/People/Raggett/tidy/">Clean up your Web pages with HTML TIDY</a>.</p>
<p>Satisfied with his work Dave passed the torch to a dedicated group of
maintainers at <a href="http://tidy.sourceforge.net/">tidy.sourceforge.net</a> where the important tasks of turning
<strong>Tidy</strong> into a C library and keeping up with developing standards was
performed.</p>
<p>W3C members took a renewed interest in <strong>Tidy</strong> in 2011 and forked the
project to <a href="https://github.com/w3c/tidy-html5">github</a> (now redirects to this project), where it featured
compatibility with HTML5 via a <a href="https://lists.w3.org/Archives/Public/www-archive/2011Nov/0007.html">key contribution</a> from one of the SourceForge
key members.</p>
<p>In 2015 a group of concerned developers, users, and software integrators formed
<a href="http://www.htacg.org">HTACG</a> with the goal of revitalizing <strong>Tidy</strong>, which had fallen into a
non-maintained state. As a W3C Community Group, HTACG was deemed worthy by the
W3C, and W3C passed ownership of their project to HTACG, where it is currently
being developed and prepped for a new, stable, and modern release.</p>
<p>HTACG is also working diligently with the SourceForge maintainers in an effort
to harmonize <strong>HTML Tidy</strong> into a single, stable, solid release once again.</p>
\code
+-----------------------------+
|w3.org/People/Raggett/tidy/|
++-------------+--------------+
||
||+----------------------+
|+-->|tidy.sourceforge.net|
|+------------------+---+
||
|+--------------------+------+|Soon
+-->|github.com/w3c/tidy|html5||
+-+------------------+------+|
||
||+-------------------------------+
|+->|Youarehere:|
||github.com/htacg/tidy-html5|
+----------------------------->+----------------------+--------+
\endcode
*/

View file

@ -0,0 +1,14 @@
/*!
\page license License
License and Legal
<pre>
\htmlinclude LICENSE.md
</pre>
*/

View file

@ -0,0 +1,12 @@
/*!
\page quick_ref Quick Ref
Quick reference generated from the tidy command
\htmlinclude quickref_include.html
*/

View file

@ -0,0 +1,18 @@
/*!
Running the tidy command
\page tidy_cmd tidy command
- \subpage tidy_quickstart
- \subpage tidy_config
- \subpage featured_options
- \subpage tidy_scripting
<pre>
\htmlinclude tidy5.help.txt
</pre>
*/

View file

@ -0,0 +1,46 @@
/*!
\page tidy_config Configuration
Configuration settings and files
\tableofcontents
To get a list of all configuration settings, see \ref config_options below or use:
\code{.sh}
tidy -help-config
\endcode
\section using_config Using a configuration file
The most convenient way to configure Tidy is by using separate configuration file.
Assuming you have created a Tidy configuration file named `myconfig.txt` (the name and extension dont matter), you can instruct Tidy to use it via the
command line option `-config myconfig.txt` for example:
\code {.sh}
tidy -config myconfig.txt file1.html file2.html
\endcode
Alternatively, you can name the default config file via the environment
variable named `HTML_TIDY`, the value of which is the absolute path for the config file.
You can also set config options on the command line by preceding the name of the option
immediately (no intervening space) with the string “--”; for example:
\code {.sh}
tidy --break-before-br true --show-warnings false
\endcode
You can find documentation for full set of configuration options on the \ref quick_ref page.
\section example_config Example Configuration File
\include example_config.txt
\section config_options Config Options
<pre>
\htmlinclude tidy5.config.txt
</pre>
*/

View file

@ -0,0 +1,71 @@
/*!
\page tidy_quickstart tidy command quickstart
\tableofcontents
This is the syntax for invoking Tidy from the command line:
\code{.sh}
tidy [[options] filename]
\endcode
Tidy defaults to reading from standard input, so if you run Tidy without specifying the filename argument, it will just sit there waiting for input to read.
Tidy defaults to writing to standard output. So you can pipe output from Tidy to other programs, as well as pipe output from other programs to Tidy. You can page through the output from Tidy by piping it to a pager, e.g.:
\code{.sh}
tidy file.html | less
\endcode
\section out_file Output to file
To have Tidy write its output to a file instead, either use the
\code{.sh}
-o filename
or
-output filename
\endcode
option, or redirect standard output to the file. For example:
\code{.sh}
tidy -o output.html index.html
tidy -output output.html index.html
tidy index.html > output.html
\endcode
All the above run Tidy on the file `index.html` and write the output to the file `output.html`, while writing any error messages to standard error.
\section out_error Error output
Tidy defaults to writing its error messages to standard error (that is, to the console where youre running Tidy). To page through the error messages along with the
output, redirect standard error to standard output, and pipe it to your pager:
\code{.sh}
tidy index.html 2>&1 | less
\endcode
To have Tidy write the errors to a file instead, either use
\code{.sh}
-f filename
or
-file filename
\endcode
option, or redirect standard error to a file:
\code{.sh}
tidy -o output.html -f errs.txt index.html
tidy index.html > output.html 2> errs.txt
\endcode
Both the above run Tidy on the file `index.html` and writes the output to the file `output.html`, while writing any error messages to the `file errs.txt`.
Writing the error messages to a file is especially useful if the file you are checking has many errors; reading them from a file instead of the console
or pager can make it easier to review them.
\section out_modify Modify / Overwrite
You can use the or `-m` or `-modify` option to modify (in-place) the contents of the input file you are checking; that is, to overwrite those contents with the output from Tidy. For example:
\code{.sh}
tidy -f errs.txt -m index.html
\endcode
That runs Tidy on the file `index.html`, modifying it in place and writing the error messages to the file `errs.txt`.
\warning If you use the `-m` option, you should first ensure that you have a backup copy of your file.
*/

View file

@ -0,0 +1,31 @@
/*!
\page tidy_scripting Running tidy in scripts
If you want to run Tidy from a Perl, bash, or other scripting language you may find it of value to inspect the result returned
by Tidy when it exits:
- \b 0 = if everything is fine
- \b 1 = if there were warnings and
- \b 2 = if there were errors.
\section perl_example_script Example Perl script
\code{.pl}
if (close(TIDY) == 0) {
my $exitcode = $? &gt;&gt; 8;
if ($exitcode == 1) {
printf STDERR "tidy issued warning messages\n";
} elsif ($exitcode == 2) {
printf STDERR "tidy issued error messages\n";
} else {
die "tidy exited with code: $exitcode\n";
}
} else {
printf STDERR "tidy detected no errors\n";
}
\endcode
*/

View file

@ -0,0 +1,53 @@
/*!
\page tidylib tidylib
About the tidylib C library and code
\tableofcontents
\section about_tidylib TidyLib features
- easy to integrate. Because of the near universal adoption of C linkage, a C interface may be called from a great number of programming languages.
- designed to use opaque types in the public interface. This allows the application to just pass an integer around and the need to transform data types in different languages is minimized. As a results its straight-forward to write very thin library wrappers for C++, Pascal, and COM/ATL.
- eats its own dogfood. HTML Tidy links directly to TidyLib.
- is Thread Safe and Re-entrant. Because there are many uses for HTML Tidy - from content validation, content scraping, conversion to XHTML - it was important to make TidyLib run reasonably well within server applications as well as client side.
- uses adaptable I/O. As part of the larger integration strategy it was decided to fully abstract all I/O. This means a (relatively) clean separation between character encoding processing and shovelling bytes back and forth. Internally, the library reads from sources and writes to sinks. This abstraction is used for both markup and configuration “files”. Concrete implementations are provided for file and memory I/O, and new sources and sinks may be provided via the public interface.
\section return_code Return codes
Its important to understand that API functions that return an integer almost universally adhere to the following convention:
- \b 0 == \b Success
- Good to go.
- \b 1 == \b Warnings, but no errors
- Check the error buffer or track error messages for details.
- \b 2 == \b Errors (and maybe warnings)
- By default, Tidy will not produce output. You can force output with the TidyForceOutput option. As with warnings, check error buffer or track error messages for details.
- <b>< 0</b> == <b>Severe error</b>
- Usually value equals `-errno`. See errno.h.
Also, by default, warning and error messages are sent to stderr. You can redirect diagnostic
output using either tidySetErrorFile() or tidySetErrorBuffer(). See tidy.h for details.
\section app_notes Application Notes
Of course, there are functions to parse and save both markup and configuration files. For the adventurous, it is possible to create new input sources and output sinks. For example, a URL source could pull the markup from a given URL.
It is also worth remembering that an application may instantiate any number of document and buffer objects. They are fairly cheap to initialize and destroy (just memory allocation and zeroing, really), so they may be created and destroyed locally, as needed. There is no problem keeping them around a while for keeping state. For example, a server app might keep a global document as a master configuration. As documents are parsed, they can copy their configuration data from the master instance. See tidyOptCopyConfig(). If the master copy is initialized at startup, no synchronization is necessary.
\section example_hello tidylib example
\include example.1.c
*/

View file

@ -0,0 +1,14 @@
/*!
\page todo Todo List
The todo list.
\note If this page is empty, then there are no todo items flagged in source.
\xrefitem todo "Todo" "Todo List"
*/

View file

@ -0,0 +1,244 @@
<?xml version="1.0"?>
<!--
For generating the `quickref.html` web page from output of
`tidy -xml-config`
(c) 2005 (W3C) MIT, ERCIM, Keio University
See tidy.h for the copyright notice.
Written by Charles Reitzel and Jelks Cabaniss
-->
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"
encoding="us-ascii"
omit-xml-declaration="yes"
/>
<xsl:template match="/">
<a name="qtop"></a>
<h2 id="top">Option Groups</h2>
<ul>
<li><a class="h3" href="#MarkupHeader">HTML, XHTML, XML</a></li>
<li><a class="h3" href="#DiagnosticsHeader">Diagnostics</a></li>
<li><a class="h3" href="#PrettyPrintHeader">Pretty Print</a></li>
<li><a class="h3" href="#EncodingHeader">Character Encoding</a></li>
<li><a class="h3" href="#MiscellaneousHeader">Miscellaneous</a></li>
</ul>
<xsl:call-template name="link-section" />
<xsl:call-template name="detail-section" />
</xsl:template>
<!-- Named Templates: -->
<xsl:template name="link-section">
<table summary="Tidy Options Quick Reference Header Section" border="0"
cellpadding="3" cellspacing="0" class="quickref">
<colgroup>
<col width="33%" />
<col width="33%" />
<col width="33%" />
</colgroup>
<xsl:call-template name="links">
<xsl:with-param name="class">markup</xsl:with-param>
<xsl:with-param name="header">HTML, XHTML, XML</xsl:with-param>
<xsl:with-param name="headerID">MarkupHeader</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="links">
<xsl:with-param name="class">diagnostics</xsl:with-param>
<xsl:with-param name="header">Diagnostics</xsl:with-param>
<xsl:with-param name="headerID">DiagnosticsHeader</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="links">
<xsl:with-param name="class">print</xsl:with-param>
<xsl:with-param name="header">Pretty Print</xsl:with-param>
<xsl:with-param name="headerID">PrettyPrintHeader</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="links">
<xsl:with-param name="class">encoding</xsl:with-param>
<xsl:with-param name="header">Character Encoding</xsl:with-param>
<xsl:with-param name="headerID">EncodingHeader</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="links">
<xsl:with-param name="class">misc</xsl:with-param>
<xsl:with-param name="header">Miscellaneous</xsl:with-param>
<xsl:with-param name="headerID">MiscellaneousHeader</xsl:with-param>
</xsl:call-template>
</table>
</xsl:template>
<xsl:template name="detail-section">
<table summary="Tidy Options Quick Reference Detail Section" border="0"
cellpadding="3" cellspacing="0">
<xsl:call-template name="reference">
<xsl:with-param name="class">markup</xsl:with-param>
<xsl:with-param name="header">HTML, XHTML, XML</xsl:with-param>
<xsl:with-param name="headerID">MarkupReference</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="reference">
<xsl:with-param name="class">diagnostics</xsl:with-param>
<xsl:with-param name="header">Diagnostics</xsl:with-param>
<xsl:with-param name="headerID">DiagnosticsReference</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="reference">
<xsl:with-param name="class">print</xsl:with-param>
<xsl:with-param name="header">Pretty Print</xsl:with-param>
<xsl:with-param name="headerID">PrettyPrintReference</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="reference">
<xsl:with-param name="class">encoding</xsl:with-param>
<xsl:with-param name="header">Character Encoding</xsl:with-param>
<xsl:with-param name="headerID">EncodingReference</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="reference">
<xsl:with-param name="class">misc</xsl:with-param>
<xsl:with-param name="header">Miscellaneous</xsl:with-param>
<xsl:with-param name="headerID">MiscellaneousReference</xsl:with-param>
</xsl:call-template>
</table>
</xsl:template>
<xsl:template name="links">
<xsl:param name="class"/>
<xsl:param name="header"/>
<xsl:param name="headerID"/>
<tr valign="bottom">
<td class="h3" colspan="2" id="{$headerID}">
<xsl:value-of select="$header"/> Options</td>
<td valign="top" class="h3top"><a href="#qtop" class="h3topa">Top</a></td>
</tr>
<xsl:call-template name="ClassHeaders" />
<xsl:for-each select="/config/option[@class=$class]">
<xsl:sort select="name" order="ascending" />
<tr>
<td class="qrow"><a href="#{name}"><xsl:value-of select="name"/></a></td>
<td class="qrow"><xsl:apply-templates select="type"/></td>
<td class="qrow"><xsl:choose>
<xsl:when test="string-length(default) &gt; 0 ">
<xsl:apply-templates select="default" />
</xsl:when>
<xsl:otherwise>
<strong>-</strong>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:for-each>
<tr valign="bottom">
<td colspan="3">&#160;</td>
</tr>
</xsl:template>
<xsl:template name="reference">
<xsl:param name="class"/>
<xsl:param name="header"/>
<xsl:param name="headerID"/>
<tr>
<td colspan="3">&#160;</td>
</tr>
<tr valign="bottom">
<td valign="top" colspan="3" class="h2" id="{$headerID}">
<h2 class="qh2"><xsl:value-of select="$header"/></h2>
</td>
</tr>
<xsl:for-each select="/config/option[@class=$class]">
<xsl:sort select="name" order="ascending" />
<tr>
<td valign="top" id="{name}" colspan="2" class="qoptiontitletd">
<h4 class="qoptiontitle"><xsl:value-of select="name"/></h4>
</td>
<td class="tabletitlelink" valign="top" align="right">
<a href="#qtop">Top</a>
</td>
</tr>
<tr>
<td valign="top" class="qlabel">Type:</td>
<td class="qvalu"><xsl:value-of select="type"/></td>
</tr>
<tr>
<td valign="top" class="qlabel">Default:</td>
<td class="qvalu">
<xsl:choose>
<xsl:when test="string-length(default) &gt; 0">
<xsl:apply-templates select="default" />
</xsl:when>
<xsl:otherwise>-</xsl:otherwise>
</xsl:choose>
</td>
</tr>
<tr>
<td valign="top" class="qlabel">Example:</td>
<td class="qvalu">
<xsl:choose>
<xsl:when test="string-length(example) &gt; 0">
<xsl:apply-templates select="example"/>
</xsl:when>
<xsl:otherwise>-</xsl:otherwise>
</xsl:choose>
</td>
</tr>
<xsl:choose>
<xsl:when test="seealso">
<tr>
<td valign="top" class="qlabel">See Also:</td>
<td valign="top" class="qvalu">
<xsl:for-each select="seealso">
<a href="#{.}"><xsl:apply-templates select="." /></a>
<xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
</td>
</tr>
</xsl:when>
</xsl:choose>
<tr>
<td></td>
<td colspan="1" class="qdescription"><xsl:apply-templates select="description"/></td>
</tr>
<tr>
<td>&#160;</td>
</tr>
</xsl:for-each>
</xsl:template>
<xsl:template name="ClassHeaders">
<tr>
<td class="tabletitle">Option</td>
<td class="tabletitle">Type</td>
<td class="tabletitle">Default</td>
</tr>
</xsl:template>
<xsl:template name="Stylesheet">
<style type="text/css">
/* no style */
</style>
</xsl:template>
<!-- Regular Templates: -->
<xsl:template match="a | code | em | strong | br">
<xsl:element name="{local-name(.)}">
<xsl:copy-of select="@* | node()" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,304 @@
body {
background-color: #efefef;
}
#titlearea {
background-image: url(http://www.html-tidy.org/assets/images/green-abstract-background.jpg);
background-size: cover;
}
#projectname {
font-family: sans-serif;
font-size: 22pt;
margin: 0 0 0 0;
margin-left: 150px;
padding: 2px 0px;
color: white;
}
#projectnumber {
font-size: 12pt;
}
#projectbrief {
font-family: sans-serif;
font-size: 10pt;
color: #dddddd;
margin-left: 150px;
}
.contents h1 {
font-size: 15pt;
font-family: monospace;
color: #4D4D74;
font-weight: bold;
border-left: none;
border-top: none;
border-bottom: 2px solid #cccccc;
margin: 30px 0px 10px 0px;
padding: 5px 0 5px 10px;
}
.contents h2 {
font-size: 12pt;
font-family: monospace;
color: #4D4D74;
font-weight: bold;
border-top: none;
border-bottom: 1px solid #dddddd;
margin: 20px 20% 20px 0px;
padding: 2px 0 2px 10px;
}
.contents p {
line-height: 130%;
font-size: 11pt;
font-family: sans-serif;
margin: 10px 20% 15px 10px;
padding: 0px;
}
.contents ul{
list-style-type: disc;
font-size: 11pt;
margin: 5px 20% 5px 40px;
padding: 0px;
line-height: 140%;
}
.contents ul ul{
list-style-type: circle;
margin-left: 30px;
}
.contents li{
padding: 2px 0 2px 0;
margin: 0;
ssbackground-color: pink;
}
.contents .textblock{
font-size: 10pt;
margin: 10px 50px 10px 50px;
line-height: 140%;
}
.contents .textblock code{
font-family: monospace;
font-size: 9pt;
}
.contents .todo{
font-size: 11pt;
margin: 10px 10% 20px 30px;
}
.contents .bug{
font-size: 11pt;
margin: 10px 10% 20px 30px;
}
dl
{
padding: 0 0 0 10px;
}
/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */
dl.section
{
margin-left: 0px;
padding-left: 0px;
}
dl.note
{
margin: 5px 10% 5px 30px;
padding: 10px;
border-left: 4px solid;
border-color: #D0C000;
background-color: #FFFAC5;
border-radius: 10px;
}
ul dl.note{
margin-right: 0;
}
dl.warning, dl.attention
{
margin: 5px 10% 5px 30px;
padding: 10px;
border-left: 4px solid;
border-color: #FF909F;
background-color: #FFE1E5;
border-radius: 10px;
}
dl.pre, dl.post, dl.invariant
{
margin-left:-7px;
padding-left: 3px;
border-left:4px solid;
border-color: #00D000;
}
dl.deprecated
{
margin: 5px 10% 5px 30px;
padding: 10px;
border-left:4px solid #B10BBF;
background-color: #FBC9FF;
border-radius: 10px;
}
dl.todo
{
margin: 5px 10% 5px 30px;
padding: 10px;
border-left:4px solid #00C0E0;
background-color: #DCFAFF ;
border-radius: 10px;
}
dl.bug
{
margin: 5px 10% 5px 30px;
padding: 10px;
border-left:4px solid red;
background-color: #FFC3B9 ;
border-radius: 10px;
}
dl.test
{
margin-left:-7px;
padding-left: 3px;
border-left:4px solid;
border-color: #3030E0;
}
dl.bug
{
margin-left:-7px;
padding-left: 3px;
border-left:4px solid;
border-color: #C08050;
}
dl.section dd {
margin-bottom: 6px;
}
table.directory tr {
border-bottom: 1px solid #cccccc !important;
}
table.directory tr:hover {
background-color: #F6FF88 !important;
}
table.directory td {
padding: 5px;
font-family: sans-serif;
}
/*****************************************************/
/* Quickref */
table.quickref {
font-size: 9pt;
font-family: monospace;
}
table.quickref tr:hover{
background-color: #F6FF88;
}
table.quickref td.qrow {
border-bottom: 1px solid #cccccc !important;
}
table td.h2 {
padding: 0;
margin: 0;
}
.qh2 {
background-color: #333333;
color: #eeeeee !important;
padding: 10px;
border-radius: 5px;
border: none;
margin: 0;
padding: 8px;
font-size: 15pt;
width: 100%;
}
table td.h3 {
background-color: #333333;
color: #eeeeee;
padding: 8px;
border-top-left-radius: 8px;
}
table td.h3top {
background-color: #333333;
padding: 8px;
border-top-right-radius: 8px;
text-align: right;
font-size: 8pt;
}
table td.h3top a{
color: #dddddd !important;
}
.h3topssssa {
color: #333333;
}
table td.tabletitle {
background-color: #cccccc;
font-size: 8pt;
}
td.tabletitlelink {
font-size: 8pt;
}
td.qoptiontitletd {
padding: 0;
margin: 0;
}
h4.qoptiontitle {
background-color: #bbbbbb;
font-size: 11pt;
font-weight: bold;
font-family: monospace;
padding: 5px 5px 5px 10px;
margin: 0;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.qlabel {
text-align: right;
font-size: 9pt;
width: 80px;
border-bottom: 1px solid #bbbbbb;
background-color: #dddddd;
font-family: sans-serif;
}
.qvalu {
font-size: 9pt;
font-weight: bold;
border-bottom: 1px solid #bbbbbb;
font-family: monospace;
border-left: 1px solid #bbbbbb;
}
.qdescription {
font-size: 11pt;
color: #333333;
margin: 0;
padding: 5px;
line-height: 140%;
border-left: 1px solid #bbbbbb;
border-bottom: 1px solid #bbbbbb;
}

View file

@ -1,164 +0,0 @@
/*!
\mainpage Tidy home
\note The repository <a href="https://github.com/htacg/tidy-html5">github.com/htacg/tidy-html5</a> and this documentation should be considered canonical for HTML Tidy as of 2015-January-15.
<h4>What is tidy ?</h4>
- \b `tidy`
- is a console application for Mac OS X, Linux, Windows, UNIX, and more.
- It corrects and cleans up HTML and XML documents by fixing markup errors and upgrading legacy code to modern standards.
- \b `tidylib`
- is a C static or dynamic library that developers can integrate into their applications
in order to bring all of Tidys power to your favorite tools.
- `tidylib` is used today in desktop applications, web servers, and more.
\section content Contents
- \ref tidy5_cmd
- \ref building_tidy
- \ref history
\page tidy5_cmd `tidy5` command
<pre>
\htmlinclude tidy5.cmd.txt
</pre>
\page TidyLib TidyLib
- \b TidyLib - is easy to integrate. Because of the near universal adoption of C linkage, a C interface may be called from a great number of programming languages.
- \b TidyLib - is designed to use opaque types in the public interface. This allows the application to just pass an integer around and the need to transform data types in different languages is minimized. As a results its straight-forward to write very thin library wrappers for C++, Pascal, and COM/ATL.
- \b TidyLib - eats its own dogfood. HTML Tidy links directly to TidyLib.
- \b TidyLib - is Thread Safe and Re-entrant. Because there are many uses for HTML Tidy - from content validation, content scraping, conversion to XHTML - it was important to make TidyLib run reasonably well within server applications as well as client side.
- \b TidyLib - uses adaptable I/O. As part of the larger integration strategy it was decided to fully abstract all I/O. This means a (relatively) clean separation between character encoding processing and shovelling bytes back and forth. Internally, the library reads from sources and writes to sinks. This abstraction is used for both markup and configuration “files”. Concrete implementations are provided for file and memory I/O, and new sources and sinks may be provided via the public interface.
\section example_hello Example
\include example.1.c
\page building_tidy Building Tidy
\section Prerequisites
- \b git - <a href="http://git-scm.com/book/en/v2/Getting-Started-Installing-Git">git-scm.com/book/en/v2/Getting-Started-Installing-Git</a>
- \b cmake - <a href="http://www.cmake.org/download/">cmake.org/download/</a>
- Appropriate build tools for the platform
CMake comes in two forms - command line and gui. Some installations only install one or the other, but sometimes both. The build
commands below are only for the command line use.
Also the actual build tools vary for each platform. But that is one of the great features of cmake, it can generate
variuous 'native' build files. Running cmake without any parameters will list the generators
available on that platform. For sure one of the common ones is "Unix Makefiles", which needs autotools
make installed, but many other generators are supported.
In windows cmake offers various versions of MSVC. Again below only the command line use of MSVC is shown, but the
tidy solution (*.sln) file can be loaded into the MSVC IDE, and the building done in there.
\section get_source Get the source code
Tidys sourcecode can be found at <a href="https://github.com/htacg/tidy-html5">github.com/htacg/tidy-html5</a>. There are sometimes
several branches, but in general `master` is the most recently updated version.
\note Note that as “cutting edge,” it may have bugs or other
unstable behavior. If you prefer a stable, officially released version, be sure to have a look
at Releases on the github page.
In general you can use the <b>Download ZIP</b> button on the github page to download the most recent version of a branch. If you prefer
Git then you can clone the repository to a working machine with:
\code{.sh}
git clone git@github.com:htacg/tidy-html5.git
\endcode
\section compile Compile
<h4>Enter the `build/cmake` directory</h4>
\code{.sh}
# *nix
cd {your-tidy-html5-directory}/build/cmake
# windows
cd {your-tidy-html5-directory}\build\cmake
\endcode
<h4>Configure the build</h4>
\code{.sh}
# *nix
cmake ../../ [-DCMAKE_INSTALL_PREFIX=/path/for/install]
# windows
cmake ..\..\
\endcode
By default cmake sets the install path to `/usr/local` in unix.
If you wanted the binary in say `/usr/bin` instead, then use `-DCMAKE_INSTALL_PREFIX=/usr`
On windows the default install is to `C:\Program Files\tidy5`, or `C:/Program Files (x86)/tidy5`, which is not very useful. After
the build the `tidy[n].exe` is in the `Release\` directory, and can be copied to any directory in your `PATH` environment variable, for global use.
If you need the tidy library built as a 'shared' (DLL) library, then in add the command `-DBUILD_SHARED_LIB:BOOL=ON`.
This option is `OFF` by default, so the static library is built and linked with the command line tool for convenience.
<h4>Compile</h4>
\code{.sh}
# *nix
make
# windows
cmake --build . --config Release
\endcode
<h4>Install</h4>
\code{.sh}
# *nix
[sudo] make install
# windows
cmake --build . --config Release --target INSTALL
\endcode
\page history History
- This repository originally transferred from w3c.github.com/tidy-html5.
- First moved to <a href="https://github.com/htacg/tidy-html5">Github</a> from <a href="http://tidy.sourceforge.net/">tidy.sourceforge.net</a>
<p><strong>HTML Tidy</strong> was created by the <a href="http://www.w3.org/">W3Cs</a> own <a href="http://www.w3.org/People/Raggett/">Dave Raggett</a> back in the
dawn of the Internet age. His original Internet page is still available and
gives a sense of the early history: <a href="http://www.w3.org/People/Raggett/tidy/">Clean up your Web pages with HTML TIDY</a>.</p>
<p>Satisfied with his work Dave passed the torch to a dedicated group of
maintainers at <a href="http://tidy.sourceforge.net/">tidy.sourceforge.net</a> where the important tasks of turning
<strong>Tidy</strong> into a C library and keeping up with developing standards was
performed.</p>
<p>W3C members took a renewed interest in <strong>Tidy</strong> in 2011 and forked the
project to <a href="https://github.com/w3c/tidy-html5">github</a> (now redirects to new maintainers), where it featured
compatibility with HTML5 via a <a href="https://lists.w3.org/Archives/Public/www-archive/2011Nov/0007.html">key contribution</a> from one of the SourceForge
key members.</p>
<p>In 2015 a group of concerned developers, users, and software integrators formed
<a href="http://www.htacg.org">HTACG</a> with the goal of revitalizing <strong>Tidy</strong>, which had fallen into a
non-maintained state. As a W3C Community Group, HTACG was deemed worthy by the
W3C, and W3C passed ownership of their project to HTACG, where it is currently
being developed and prepped for a new, stable, and modern release.</p>
<p>HTACG is also working diligently with the SourceForge maintainers in an effort
to harmonize <strong>HTML Tidy</strong> into a single, stable, solid release once again.</p>
*/