From 09a57d41b276aceb43b2e7ac05ece8afcfae7c17 Mon Sep 17 00:00:00 2001 From: Pedro Date: Thu, 5 Mar 2015 23:55:59 +0000 Subject: [PATCH] add pages for quiskstart, configuration and scripting --- build/documentation/pages/main_page.dox | 2 + build/documentation/pages/page_tidy.dox | 3 + .../pages/page_tidy_quickstart.dox | 69 +++++++++++++++++++ .../pages/page_tidy_scripting.dox | 31 +++++++++ 4 files changed, 105 insertions(+) create mode 100644 build/documentation/pages/page_tidy_quickstart.dox create mode 100644 build/documentation/pages/page_tidy_scripting.dox diff --git a/build/documentation/pages/main_page.dox b/build/documentation/pages/main_page.dox index 8b88546..667b6f4 100644 --- a/build/documentation/pages/main_page.dox +++ b/build/documentation/pages/main_page.dox @@ -36,7 +36,9 @@ is converted to \section content Contents - \ref tidy5_cmd + - \ref tidy_quickstart - \ref tidy_config + - \ref tidy_scripting - \ref tidylib - Modules - \ref building_tidy diff --git a/build/documentation/pages/page_tidy.dox b/build/documentation/pages/page_tidy.dox index 64e3887..4487d0d 100644 --- a/build/documentation/pages/page_tidy.dox +++ b/build/documentation/pages/page_tidy.dox @@ -3,6 +3,9 @@ \page tidy5_cmd `tidy5` command + - \subpage tidy_quickstart + - \subpage tidy_config +
 \htmlinclude tidy5.cmd.txt
 
diff --git a/build/documentation/pages/page_tidy_quickstart.dox b/build/documentation/pages/page_tidy_quickstart.dox new file mode 100644 index 0000000..1b05df3 --- /dev/null +++ b/build/documentation/pages/page_tidy_quickstart.dox @@ -0,0 +1,69 @@ +/*! + +\page tidy_quickstart tidy command quickstart + +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 you’re 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. + + +*/ \ No newline at end of file diff --git a/build/documentation/pages/page_tidy_scripting.dox b/build/documentation/pages/page_tidy_scripting.dox new file mode 100644 index 0000000..1a3eea7 --- /dev/null +++ b/build/documentation/pages/page_tidy_scripting.dox @@ -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 = $? >> 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 + + + +*/ \ No newline at end of file