From 1b39e2c5632038aecc13a24967b4d959b8009897 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Mon, 15 Nov 2004 15:54:28 +0000 Subject: [PATCH] tidy docs revision part 1 fix return/parameter types add some examples rename some files, tidy_node to tidyNode git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@172700 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/tidy/functions/ob-tidyhandler.xml | 6 +- .../tidy/functions/tidy-access-count.xml | 4 +- .../tidy/functions/tidy-clean-repair.xml | 12 ++-- .../tidy/functions/tidy-config-count.xml | 7 ++- reference/tidy/functions/tidy-construct.xml | 6 +- reference/tidy/functions/tidy-diagnose.xml | 51 +++++++++++++++- reference/tidy/functions/tidy-error-count.xml | 4 +- reference/tidy/functions/tidy-get-body.xml | 12 ++-- reference/tidy/functions/tidy-get-config.xml | 17 +++--- .../tidy/functions/tidy-get-error-buffer.xml | 8 +-- reference/tidy/functions/tidy-get-head.xml | 12 ++-- .../tidy/functions/tidy-get-html-ver.xml | 6 +- reference/tidy/functions/tidy-get-html.xml | 12 ++-- reference/tidy/functions/tidy-get-output.xml | 8 +-- reference/tidy/functions/tidy-get-root.xml | 59 +++++++++++++++++-- reference/tidy/functions/tidy-get-status.xml | 6 +- reference/tidy/functions/tidy-getopt.xml | 12 ++-- reference/tidy/functions/tidy-is-xhtml.xml | 8 +-- reference/tidy/functions/tidy-is-xml.xml | 9 +-- .../tidy/functions/tidy-node-attributes.xml | 41 ------------- .../tidy/functions/tidy-node-tidy-node.xml | 41 ------------- reference/tidy/functions/tidy-parse-file.xml | 4 +- .../tidy/functions/tidy-parse-string.xml | 4 +- .../tidy/functions/tidy-warning-count.xml | 4 +- ...tidy-node-isAsp.xml => tidyNode-isAsp.xml} | 15 ++--- ...tidy-node-isPhp.xml => tidyNode-isPhp.xml} | 14 ++--- 26 files changed, 188 insertions(+), 194 deletions(-) delete mode 100644 reference/tidy/functions/tidy-node-attributes.xml delete mode 100644 reference/tidy/functions/tidy-node-tidy-node.xml rename reference/tidy/functions/{tidy-node-isAsp.xml => tidyNode-isAsp.xml} (75%) mode change 100644 => 100755 rename reference/tidy/functions/{tidy-node-isPhp.xml => tidyNode-isPhp.xml} (87%) diff --git a/reference/tidy/functions/ob-tidyhandler.xml b/reference/tidy/functions/ob-tidyhandler.xml index 187a60c9f9..022ed23eac 100755 --- a/reference/tidy/functions/ob-tidyhandler.xml +++ b/reference/tidy/functions/ob-tidyhandler.xml @@ -1,5 +1,5 @@ - + ob_tidyhandler @@ -30,9 +30,7 @@ echo '

test'; ?> ]]> - - The above example will output: - + &example.outputs; diff --git a/reference/tidy/functions/tidy-access-count.xml b/reference/tidy/functions/tidy-access-count.xml index 8dd4514b07..3137f378fc 100644 --- a/reference/tidy/functions/tidy-access-count.xml +++ b/reference/tidy/functions/tidy-access-count.xml @@ -1,5 +1,5 @@ - + tidy_access_count @@ -11,7 +11,7 @@ Description inttidy_access_count - resourcetidy + tidyobject tidy_access_count returns the number of diff --git a/reference/tidy/functions/tidy-clean-repair.xml b/reference/tidy/functions/tidy-clean-repair.xml index 59cd56660b..d7dd6f6c4b 100644 --- a/reference/tidy/functions/tidy-clean-repair.xml +++ b/reference/tidy/functions/tidy-clean-repair.xml @@ -1,5 +1,5 @@ - + tidy_clean_repair @@ -12,7 +12,7 @@ Procedural style: booltidy_clean_repair - resourcetidy + tidyobject Object oriented style: @@ -20,8 +20,8 @@ - This function cleans and repairs the given tidy - resource. + This function cleans and repairs the given tidy + object. @@ -38,9 +38,7 @@ echo $tidy; ?> ]]> - - The above example will output: - + &example.outputs; diff --git a/reference/tidy/functions/tidy-config-count.xml b/reference/tidy/functions/tidy-config-count.xml index d408ab387c..33a5b99a0d 100644 --- a/reference/tidy/functions/tidy-config-count.xml +++ b/reference/tidy/functions/tidy-config-count.xml @@ -1,5 +1,5 @@ - + tidy_config_count @@ -11,11 +11,12 @@ Description inttidy_config_count - resourcetidy + tidyobject tidy_config_count returns the number of errors - encountered in the given configuration. + encountered in the configuration of the specified tidy + object. diff --git a/reference/tidy/functions/tidy-construct.xml b/reference/tidy/functions/tidy-construct.xml index e9b2174d45..16c77414ba 100755 --- a/reference/tidy/functions/tidy-construct.xml +++ b/reference/tidy/functions/tidy-construct.xml @@ -1,5 +1,5 @@ - + tidy::__construct @@ -59,9 +59,7 @@ if ($tidy->errorBuffer) { ?> ]]> - - The above example will output: - + &example.outputs; - + tidy_diagnose @@ -12,7 +12,7 @@ Procedural style: booltidy_diagnose - resourcetidy + tidyobject Object oriented style: @@ -21,11 +21,56 @@ tidy_diagnose runs diagnostic tests on the given - resource. + tidy object, adding some more information about + the document in the error buffer. &return.success; + + + <function>tidy_diagnose</function> example + + + +

paragraph

+HTML; + +$tidy = tidy_parse_string($html); +$tidy->CleanRepair(); + +// note the difference between the two outputs +echo tidy_get_error_buffer($tidy) . "\n"; + +$tidy->diagnose(); +echo tidy_get_error_buffer($tidy); + +?> +]]> + + &example.outputs; + + isn't allowed in elements +line 5 column 1 - Warning: inserting missing 'title' element + +line 5 column 1 - Warning:

isn't allowed in elements +line 5 column 1 - Warning: inserting missing 'title' element +Info: Doctype given is "-//W3C//DTD XHTML 1.0 Strict//EN" +Info: Document content looks like XHTML 1.0 Strict +2 warnings, 0 errors were found! +]]> + + + + + See also tidy_get_error_buffer. + diff --git a/reference/tidy/functions/tidy-error-count.xml b/reference/tidy/functions/tidy-error-count.xml index 3c283975aa..6c70c420f2 100644 --- a/reference/tidy/functions/tidy-error-count.xml +++ b/reference/tidy/functions/tidy-error-count.xml @@ -1,5 +1,5 @@ - + tidy_error_count @@ -11,7 +11,7 @@ Description inttidy_error_count - resourcetidy + tidyobject tidy_error_count returns the number of Tidy errors diff --git a/reference/tidy/functions/tidy-get-body.xml b/reference/tidy/functions/tidy-get-body.xml index 9bd69a4089..05dbf77160 100644 --- a/reference/tidy/functions/tidy-get-body.xml +++ b/reference/tidy/functions/tidy-get-body.xml @@ -1,10 +1,10 @@ - + tidy_get_body - Returns a TidyNode Object starting from the <body> tag of the tidy parse tree + Returns a tidyNode Object starting from the <body> tag of the tidy parse tree @@ -12,7 +12,7 @@ Procedural style: tidyNodetidy_get_body - resourcetidy + tidyobject Object oriented style: @@ -20,7 +20,7 @@ - This function returns a TidyNode object starting from the <body> + This function returns a tidyNode object starting from the <body> tag of the tidy parse tree. @@ -46,9 +46,7 @@ echo $body->value; ?> ]]> - - The above example will output: - + &example.outputs; diff --git a/reference/tidy/functions/tidy-get-config.xml b/reference/tidy/functions/tidy-get-config.xml index ef1463535b..473d4575e8 100644 --- a/reference/tidy/functions/tidy-get-config.xml +++ b/reference/tidy/functions/tidy-get-config.xml @@ -1,5 +1,5 @@ - + tidy_get_config @@ -12,7 +12,7 @@ Procedural style: arraytidy_get_config - resourcetidy + tidyobject Object oriented style: @@ -21,10 +21,12 @@ tidy_get_config returns an array with the - configuration options in use by the given resource. + configuration options in use by the given tidy + object. - For a explanation about each option, visit &url.tidy.conf;. + For an explanation about each option, visit &url.tidy.conf;. @@ -43,15 +45,13 @@ print_r(tidy_get_config($tidy)); ?> ]]> - - The above example will output: - + &example.outputs; 2 - [wrap] => 68 + [wrap] => 200 [tab-size] => 8 [char-encoding] => 1 [input-encoding] => 3 @@ -131,6 +131,7 @@ Array [accessibility-check] => 0 [vertical-space] => [punctuation-wrap] => + [merge-divs] => 1 ) ]]> diff --git a/reference/tidy/functions/tidy-get-error-buffer.xml b/reference/tidy/functions/tidy-get-error-buffer.xml index 1e9438ecc4..253303cab0 100644 --- a/reference/tidy/functions/tidy-get-error-buffer.xml +++ b/reference/tidy/functions/tidy-get-error-buffer.xml @@ -1,5 +1,5 @@ - + tidy_get_error_buffer @@ -12,7 +12,7 @@ Procedural style: stringtidy_get_error_buffer - resourcetidy + tidyobject Object oriented style (property): @@ -39,9 +39,7 @@ echo $tidy->errorBuffer; ?> ]]> - - The above example will output: - + &example.outputs; declaration diff --git a/reference/tidy/functions/tidy-get-head.xml b/reference/tidy/functions/tidy-get-head.xml index 6921f9f4db..9c815a048d 100644 --- a/reference/tidy/functions/tidy-get-head.xml +++ b/reference/tidy/functions/tidy-get-head.xml @@ -1,10 +1,10 @@ - + tidy_get_head - Returns a TidyNode Object starting from the <head> tag of the tidy parse tree + Returns a tidyNode Object starting from the <head> tag of the tidy parse tree @@ -12,7 +12,7 @@ Procedural style: tidyNodetidy_get_head - resourcetidy + tidyobject Object oriented style: @@ -20,7 +20,7 @@ - This function returns a TidyNode object starting from the <head> + This function returns a tidyNode object starting from the <head> tag of the tidy parse tree. @@ -46,9 +46,7 @@ echo $head->value; ?> ]]> - - The above example will output: - + &example.outputs; diff --git a/reference/tidy/functions/tidy-get-html-ver.xml b/reference/tidy/functions/tidy-get-html-ver.xml index 4a4166455a..a6e48c9d36 100644 --- a/reference/tidy/functions/tidy-get-html-ver.xml +++ b/reference/tidy/functions/tidy-get-html-ver.xml @@ -1,5 +1,5 @@ - + tidy_get_html_ver @@ -12,7 +12,7 @@ Procedural style: inttidy_get_html_ver - resourcetidy + tidyobject Object oriented style: @@ -21,7 +21,7 @@ tidy_get_html_ver returns the detected HTML version - for the specified tidy resource. + for the specified tidy object. diff --git a/reference/tidy/functions/tidy-get-html.xml b/reference/tidy/functions/tidy-get-html.xml index 3ea87c26d9..6013dfc54d 100644 --- a/reference/tidy/functions/tidy-get-html.xml +++ b/reference/tidy/functions/tidy-get-html.xml @@ -1,10 +1,10 @@ - + tidy_get_html - Returns a TidyNode Object starting from the <html> tag of the tidy parse tree + Returns a tidyNode Object starting from the <html> tag of the tidy parse tree @@ -12,7 +12,7 @@ Procedural style: tidyNodetidy_get_html - resourcetidy + tidyobject Object oriented style: @@ -20,7 +20,7 @@ - This function returns a TidyNode object starting from the <html> + This function returns a tidyNode object starting from the <html> tag of the tidy parse tree. @@ -46,9 +46,7 @@ echo $html->value; ?> ]]> - - The above example will output: - + &example.outputs; diff --git a/reference/tidy/functions/tidy-get-output.xml b/reference/tidy/functions/tidy-get-output.xml index e06e3c56bb..9c7f8f2e98 100644 --- a/reference/tidy/functions/tidy-get-output.xml +++ b/reference/tidy/functions/tidy-get-output.xml @@ -1,5 +1,5 @@ - + tidy_get_output @@ -11,7 +11,7 @@ Description stringtidy_get_output - resourcetidy + tidyobject tidy_get_output returns a string with the repaired @@ -33,9 +33,7 @@ echo tidy_get_output($tidy); ?> ]]> - - The above example will output: - + &example.outputs; diff --git a/reference/tidy/functions/tidy-get-root.xml b/reference/tidy/functions/tidy-get-root.xml index 06b88990a7..d5a6d35528 100644 --- a/reference/tidy/functions/tidy-get-root.xml +++ b/reference/tidy/functions/tidy-get-root.xml @@ -1,11 +1,10 @@ - - + tidy_get_root - Returns a TidyNode Object representing the root of the tidy parse tree + Returns a tidyNode object representing the root of the tidy parse tree @@ -13,17 +12,65 @@ Procedural style: tidyNodetidy_get_root - resourcetidy + tidyobject Object oriented style: tidyNodetidy->root + + Returns a tidyNode object representing the root of the tidy parse tree. + + + + dump nodes + + +

paragraph

+
+ + +HTML; + +$tidy = tidy_parse_string($html); +dump_nodes($tidy->root(), 1); + + +function dump_nodes($node, $indent) { + + if($node->hasChildren()) { + foreach($node->child as $child) { + echo str_repeat('.', $indent*2) . ($child->name ? $child->name : '"'.$child->value.'"'). "\n"; + + dump_nodes($child, $indent+1); + } + } +} +?> +]]> + + &example.outputs; + + + + + + + ¬e.tidy.ze2;
diff --git a/reference/tidy/functions/tidy-get-status.xml b/reference/tidy/functions/tidy-get-status.xml index 982471b6a8..fe9238a1f9 100644 --- a/reference/tidy/functions/tidy-get-status.xml +++ b/reference/tidy/functions/tidy-get-status.xml @@ -1,5 +1,5 @@ - + tidy_get_status @@ -12,7 +12,7 @@ Procedural style: inttidy_get_status - resourcetidy + tidyobject Object oriented style: @@ -21,7 +21,7 @@ tidy_get_status returns the status for the specified - tidy resource. It returns 0 if no error/warning + tidy object. It returns 0 if no error/warning was raised, 1 for warnings or accessibility errors, or 2 for errors. diff --git a/reference/tidy/functions/tidy-getopt.xml b/reference/tidy/functions/tidy-getopt.xml index 2a729d35f2..35e7d41874 100644 --- a/reference/tidy/functions/tidy-getopt.xml +++ b/reference/tidy/functions/tidy-getopt.xml @@ -1,5 +1,5 @@ - + tidy_getopt @@ -12,7 +12,7 @@ Procedural style: mixedtidy_getopt - resourcetidy + tidyobject stringoption Object oriented style: @@ -22,8 +22,8 @@ tidy_getopt returns the value of the specified - option for the specified - tidy document. The return type depends on the type + option for the specified tidy + object. The return type depends on the type of the specified option. You will find a list with each configuration option and their types at: &url.tidy.conf;. @@ -57,9 +57,7 @@ var_dump($tidy->getOpt('alt-text')); //string ?> ]]> - - The above example will output: - + &example.outputs; - + tidy_is_xhtml @@ -12,7 +12,7 @@ Procedural style: booltidy_is_xhtml - resourcetidy + tidyobject Object oriented style: @@ -20,8 +20,8 @@ - This function returns &true; if the specified tidy - object is a XHTML document, or &false; otherwise. + This function returns &true; if the specified tidy + object is a XHTML document, or &false; otherwise. diff --git a/reference/tidy/functions/tidy-is-xml.xml b/reference/tidy/functions/tidy-is-xml.xml index 8706428d6d..42650fbf5f 100755 --- a/reference/tidy/functions/tidy-is-xml.xml +++ b/reference/tidy/functions/tidy-is-xml.xml @@ -1,5 +1,5 @@ - + tidy_is_xml @@ -12,7 +12,7 @@ Procedural style: booltidy_is_xml - resourcetidy + tidyobject Object oriented style: @@ -20,8 +20,9 @@ - This function returns &true; if the specified tidy - object is a generic XML document (non HTML/XHTML), or &false; otherwise. + This function returns &true; if the specified tidy + object is a generic XML document (non HTML/XHTML), + or &false; otherwise. diff --git a/reference/tidy/functions/tidy-node-attributes.xml b/reference/tidy/functions/tidy-node-attributes.xml deleted file mode 100644 index 0567a75c0b..0000000000 --- a/reference/tidy/functions/tidy-node-attributes.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - tidy_node->attributes - - Returns an array of attribute objects for node - - - - Description - - arraytidy_node->attributes - - - - &warn.undocumented.func; - - - - - diff --git a/reference/tidy/functions/tidy-node-tidy-node.xml b/reference/tidy/functions/tidy-node-tidy-node.xml deleted file mode 100644 index 807bb7ae1d..0000000000 --- a/reference/tidy/functions/tidy-node-tidy-node.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - tidy_node->tidy_node - - Constructor - - - - Description - - voidtidy_node->tidy_node - - - - &warn.undocumented.func; - - - - - diff --git a/reference/tidy/functions/tidy-parse-file.xml b/reference/tidy/functions/tidy-parse-file.xml index e049ee206b..3cd0e60d7a 100644 --- a/reference/tidy/functions/tidy-parse-file.xml +++ b/reference/tidy/functions/tidy-parse-file.xml @@ -1,5 +1,5 @@ - + tidy_parse_file @@ -11,7 +11,7 @@ Description Procedural style: - resourcetidy_parse_file + tidytidy_parse_file stringfilename mixedconfig stringencoding diff --git a/reference/tidy/functions/tidy-parse-string.xml b/reference/tidy/functions/tidy-parse-string.xml index 4d65edce4c..006938f83a 100644 --- a/reference/tidy/functions/tidy-parse-string.xml +++ b/reference/tidy/functions/tidy-parse-string.xml @@ -1,5 +1,5 @@ - + tidy_parse_string @@ -11,7 +11,7 @@ Description Procedural style: - resourcetidy_parse_string + tidytidy_parse_string stringinput mixedconfig stringencoding diff --git a/reference/tidy/functions/tidy-warning-count.xml b/reference/tidy/functions/tidy-warning-count.xml index c3dfdd1930..633cf735b7 100644 --- a/reference/tidy/functions/tidy-warning-count.xml +++ b/reference/tidy/functions/tidy-warning-count.xml @@ -1,5 +1,5 @@ - + tidy_warning_count @@ -11,7 +11,7 @@ Description inttidy_warning_count - resourcetidy + tidyobject tidy_warning_count returns the number of Tidy warnings diff --git a/reference/tidy/functions/tidy-node-isAsp.xml b/reference/tidy/functions/tidyNode-isAsp.xml old mode 100644 new mode 100755 similarity index 75% rename from reference/tidy/functions/tidy-node-isAsp.xml rename to reference/tidy/functions/tidyNode-isAsp.xml index 4e87215b49..5a8c273897 --- a/reference/tidy/functions/tidy-node-isAsp.xml +++ b/reference/tidy/functions/tidyNode-isAsp.xml @@ -1,8 +1,8 @@ - - + + - tidy_node->isAsp + tidyNode->isAsp Returns true if this node is ASP @@ -10,12 +10,13 @@ Description - booltidy_node->isAsp + booltidyNode->isAsp - - &warn.undocumented.func; - + + This functions returns &true; if the current node is ASP, or &false; + otherwise. + This function was named tidy_node->is_asp in diff --git a/reference/tidy/functions/tidy-node-isPhp.xml b/reference/tidy/functions/tidyNode-isPhp.xml similarity index 87% rename from reference/tidy/functions/tidy-node-isPhp.xml rename to reference/tidy/functions/tidyNode-isPhp.xml index 2533319103..ec197c91cf 100644 --- a/reference/tidy/functions/tidy-node-isPhp.xml +++ b/reference/tidy/functions/tidyNode-isPhp.xml @@ -1,8 +1,8 @@ - - + + - tidy_node->isPhp + tidyNode->isPhp Returns true if this node is PHP @@ -10,7 +10,7 @@ Description - booltidy_node->isPhp + booltidyNode->isPhp @@ -46,7 +46,7 @@ get_php($tidy->html()); function get_php($node) { // check if the current node is PHP code - if($node->isPHP()) { + if($node->isPhp()) { echo "\n\n# PHP node #" . ++$GLOBALS['num'] . "\n"; echo $node->value; } @@ -62,9 +62,7 @@ function get_php($node) { ?> ]]> - - The above example will output: - + &example.outputs;