cvs: doc-editor / error_type.php /php ToolsError.php
| From: | Yannick Torres | Date: | Mon, 20 Apr 2009 16:26:52 +0000 |
| Subject: | cvs: doc-editor / error_type.php /php ToolsError.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-3816@lists.php.net to get a copy of this message | ||
yannick Mon Apr 20 16:26:52 2009 UTC
Modified files:
/doc-editor/php ToolsError.php
/doc-editor error_type.php
Log:
- Simplify the way we search for "nb*Tag"
- Sort all information in error_type.php
- Translate some comment into english
http://cvs.php.net/viewvc.cgi/doc-editor/php/ToolsError.php?r1=1.7&r2=1.8&diff_format=u Index: doc-editor/php/ToolsError.php diff -u doc-editor/php/ToolsError.php:1.7 doc-editor/php/ToolsError.php:1.8 --- doc-editor/php/ToolsError.php:1.7 Sun Apr 19 18:15:21 2009 +++ doc-editor/php/ToolsError.php Mon Apr 20 16:26:51 2009 @@ -318,25 +318,10 @@ $this->attributVarlistentryTag(); $this->classsynopsis(); $this->methodsynopsis(); - $this->nbAcronymTag(); - $this->nbAbbrevTag(); - $this->nbCautionTag(); $this->nbCdataTag(); - $this->nbChapterTag(); - $this->nbCommandTag(); - $this->nbConstantTag(); $this->nbElInTable(); - $this->nbEmphasisTag(); - $this->nbFilenameTag(); - $this->nbLiteralTag(); $this->nbMemberInSeeAlso(); - $this->nbNoteTag(); - $this->nbParaTag(); - $this->nbProductnameTag(); - $this->nbSimparaTag(); - $this->nbTipTag(); - $this->nbVarnameTag(); - $this->nbWarningTag(); + $this->nbTag(); $this->spaceOrPeriodRefpurposeTag(); } @@ -1208,497 +1193,59 @@ } /** - * Check Nb <para> tag + * Check Nb <*> tag * Add an entry into the error's stack if an error is found * */ - function nbParaTag() + function nbTag() { - $reg = '/<para(( )(.*?))?>/s'; - - $match = array(); - preg_match_all($reg, $this->en_content, $match); - $en_para = count($match[0]); - - $match = array(); - preg_match_all($reg, $this->lang_content, $match); - $lang_para = count($match[0]); - - if ($en_para != $lang_para) { - $this->addError(array( - 'value_en' => $en_para, - 'value_lang' => $lang_para, - 'type' => 'nbParaTag' - )); - - } - } - - /** - * Check Nb <note> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbNoteTag() - { - - $reg = '/<note>/s'; - - $en_note = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_note = count($match[0]); - } - - $lang_note = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_note = count($match[0]); - } - - if ($en_note != $lang_note) { - $this->addError(array( - "value_en" => $en_note, - "value_lang" => $lang_note, - "type" => "nbNoteTag" - )); - - } - } - - /** - * Check Nb <chapter> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbChapterTag() - { - - $reg = '/<chapter /s'; - - $en_chapter = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_chapter = count($match[0]); - } - - $lang_chapter = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_chapter = count($match[0]); - } - - if ($en_chapter != $lang_chapter ) { - $this->addError(array( - "value_en" => $en_chapter, - "value_lang" => $lang_chapter, - "type" => "nbChapterTag" - )); - } - } - - /** - * Check Nb <caution> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbCautionTag() - { - - $reg = '/<caution>/s'; - - $en_Caution = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_Caution = count($match[0]); - } - - $lang_Caution = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_Caution = count($match[0]); - } - - if ($en_Caution != $lang_Caution ) { - $this->addError(array( - "value_en" => $en_Caution, - "value_lang" => $lang_Caution, - "type" => "nbCautionTag" - )); - } - } - - /** - * Check Nb <filename> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbFilenameTag() - { - - $reg = '/<filename>/s'; - - $en_filename = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_filename = count($match[0]); - } - - $lang_filename = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_filename = count($match[0]); - } - - if ($en_filename != $lang_filename ) { - $this->addError(array( - "value_en" => $en_filename, - "value_lang" => $lang_filename, - "type" => "nbFilenameTag" - )); - } - } - - /** - * Check Nb <abbrev> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbAbbrevTag() - { - - $reg = '/<abbrev>/s'; - - $en_abbrev = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_abbrev = count($match[0]); - } - - $lang_abbrev = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_abbrev = count($match[0]); - } - - if ($en_abbrev != $lang_abbrev ) { - $this->addError(array( - "value_en" => $en_abbrev, - "value_lang" => $lang_abbrev, - "type" => "nbAbbrevTag" - )); - } - } - - /** - * Check Nb <productname> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbProductnameTag() - { - - $reg = '/<productname>/s'; - - $en_productname = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_productname = count($match[0]); - } - - $lang_productname = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_productname = count($match[0]); - } - - if ($en_productname != $lang_productname ) { - $this->addError(array( - "value_en" => $en_productname, - "value_lang" => $lang_productname, - "type" => "nbProductnameTag" - )); - } - } - - /** - * Check Nb <acronym> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbAcronymTag() - { - - $reg = '/<acronym>/s'; - - $en_acronym = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_acronym = count($match[0]); - } - - $lang_acronym = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_acronym = count($match[0]); - } - - if ($en_acronym != $lang_acronym ) { - $this->addError(array( - "value_en" => $en_acronym, - "value_lang" => $lang_acronym, - "type" => "nbAcronymTag" - )); - } - } - - /** - * Check Nb <constant> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbConstantTag() - { - - $reg = '/<constant>/s'; - - $en_constant = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_constant = count($match[0]); - } - - $lang_constant = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_constant = count($match[0]); - } - - if ($en_constant != $lang_constant ) { - $this->addError(array( - "value_en" => $en_constant, - "value_lang" => $lang_constant, - "type" => "nbConstantTag" - )); - } - } - - /** - * Check Nb <warning> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbWarningTag() - { - - $reg = '/<warning>/s'; - - $en_warning = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_warning = count($match[0]); - } - - $lang_warning = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_warning = count($match[0]); - } - - if ($en_warning != $lang_warning ) { - $this->addError(array( - "value_en" => $en_warning, - "value_lang" => $lang_warning, - "type" => "nbWarningTag" - )); - } - } - - /** - * Check Nb <simpara> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbSimparaTag() - { - - $reg = '/<simpara>/s'; - - $en_simpara = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_simpara = count($match[0]); - } - - $lang_simpara = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_simpara = count($match[0]); - } - - if ($en_simpara != $lang_simpara ) { - $this->addError(array( - "value_en" => $en_simpara, - "value_lang" => $lang_simpara, - "type" => "nbSimparaTag" - )); - } - } - - /** - * Check Nb <tip> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbTipTag() - { - - $reg = '/<tip>/s'; - - $en_tip = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_tip = count($match[0]); - } - - $lang_tip = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_tip = count($match[0]); - } - - if ($en_tip != $lang_tip ) { - $this->addError(array( - "value_en" => $en_tip, - "value_lang" => $lang_tip, - "type" => "nbTipTag" - )); - } - } - - /** - * Check Nb <varname> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbVarnameTag() - { - - $reg = '/<varname>/s'; - - $en_varname = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_varname = count($match[0]); - } - - $lang_varname = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_varname = count($match[0]); - } - - if ($en_varname != $lang_varname ) { - $this->addError(array( - "value_en" => $en_varname, - "value_lang" => $lang_varname, - "type" => "nbVarnameTag" - )); - } - } - - /** - * Check Nb <emphasis> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbEmphasisTag() - { - - $reg = '/<emphasis>/s'; - - $en_emphasis = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_emphasis = count($match[0]); - } - - $lang_emphasis = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_emphasis = count($match[0]); - } - - if ($en_emphasis != $lang_emphasis ) { - $this->addError(array( - "value_en" => $en_emphasis, - "value_lang" => $lang_emphasis, - "type" => "nbEmphasisTag" - )); - } - } - - /** - * Check Nb <command> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbCommandTag() - { - - $reg = '/<command>/s'; - - $en_command = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_command = count($match[0]); - } + // When you add a new tag here, you must add it too into error_type.php files (array => tags) + $tags = array( + 'abbrev' => 'Abbrev', + 'acronym' => 'Acronym', + 'caution' => 'Caution', + 'command' => 'Command', + 'chapter' => 'Chapter', + 'constant' => 'Constant', + 'emphasis' => 'Emphasis', + 'filename' => 'Filename', + 'literal' => 'Literal', + 'note' => 'Note', + 'para' => 'Para', + 'productname' => 'Productname', + 'simpara' => 'Simpara', + 'tip' => 'Tip', + 'varname' => 'Varname', + 'warning' => 'Warning' + ); - $lang_command = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_command = count($match[0]); - } + foreach ($tags as $tag => $label) { - if ($en_command != $lang_command ) { - $this->addError(array( - "value_en" => $en_command, - "value_lang" => $lang_command, - "type" => "nbCommandTag" - )); - } - } + $reg = '/<' . $tag . ' /s'; - /** - * Check Nb <literal> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbLiteralTag() - { + $nb_en = 0; + $match = array(); + if (preg_match_all($reg, $this->en_content, $match)) { + $nb_en = count($match[0]); + } - $reg = '/<literal>/s'; + $nb_lang = 0; + $match = array(); + if (preg_match_all($reg, $this->lang_content, $match)) { + $nb_lang = count($match[0]); + } - $en_literal = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_literal = count($match[0]); - } + if ($nb_en != $nb_lang ) { + $this->addError(array( + "value_en" => $nb_en, + "value_lang" => $nb_lang, + "type" => "nb" . $label . "Tag" + )); + } - $lang_literal = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_literal = count($match[0]); - } + } // foreach - if ($en_literal != $lang_literal ) { - $this->addError(array( - "value_en" => $en_literal, - "value_lang" => $lang_literal, - "type" => "nbLiteralTag" - )); - } } /** @@ -1784,6 +1331,7 @@ $match = array(); $en_seeAlsoMember = 0; preg_match($reg, $this->en_content, $match); + if (isset($match[1])) { $match2 = array(); preg_match_all($reg2, $match[1], $match2); @@ -1795,6 +1343,7 @@ $match = array(); $lang_seeAlsoMember = 0; preg_match($reg, $this->lang_content, $match); + if (isset($match[1])) { $match2 = array(); preg_match_all($reg2, $match[1], $match2); http://cvs.php.net/viewvc.cgi/doc-editor/error_type.php?r1=1.10&r2=1.11&diff_format=u Index: doc-editor/error_type.php diff -u doc-editor/error_type.php:1.10 doc-editor/error_type.php:1.11 --- doc-editor/error_type.php:1.10 Sun Apr 19 18:15:21 2009 +++ doc-editor/error_type.php Mon Apr 20 16:26:51 2009 @@ -21,12 +21,6 @@ $fileLibel = NULL; } -/* -echo '<pre>'; -print_r($error_to_display); -echo '</pre>'; -*/ - ?> <style type="text/css"> @@ -87,6 +81,33 @@ <?php +// Commun number of tags check + +$tags = array( + 'abbrev' => 'Abbrev', + 'acronym' => 'Acronym', + 'caution' => 'Caution', + 'command' => 'Command', + 'chapter' => 'Chapter', + 'constant' => 'Constant', + 'emphasis' => 'Emphasis', + 'filename' => 'Filename', + 'literal' => 'Literal', + 'note' => 'Note', + 'para' => 'Para', + 'productname' => 'Productname', + 'simpara' => 'Simpara', + 'tip' => 'Tip', + 'varname' => 'Varname', + 'warning' => 'Warning' +); + +foreach ($tags as $tag => $label) +{ + $error['nb' . $label . 'Tag']['head'] = $label . ' tag'; + $error['nb' . $label . 'Tag']['desc'] = 'Throw if the number of <b>' . $label . '</b> tags is different from english version.'; +} + $error['-No error-']['head'] = '- No error -'; $error['-No error-']['desc'] = 'There is no more error in this file.'; @@ -117,36 +138,9 @@ $error['attributVersionChapter']['head'] = 'Chapter tag'; $error['attributVersionChapter']['desc'] = 'Throw if the value of the attribut <b>version</b> is different from english version.'; -$error['nbChapterTag']['head'] = 'Chapter tag'; -$error['nbChapterTag']['desc'] = 'Throw if the number of <b>chapter</b> tags is different from english version.'; - -$error['nbSimparaTag']['head'] = 'Simpara tag'; -$error['nbSimparaTag']['desc'] = 'Throw if the number of <b>simpara</b> tags is different from english version.'; - -$error['nbCautionTag']['head'] = 'Caution tag'; -$error['nbCautionTag']['desc'] = 'Throw if the number of <b>caution</b> tags is different from english version.'; - -$error['nbAcronymTag']['head'] = 'Acronym tag'; -$error['nbAcronymTag']['desc'] = 'Throw if the number of <b>acronym</b> tags is different from english version.'; - -$error['nbConstantTag']['head'] = 'Constant tag'; -$error['nbConstantTag']['desc'] = 'Throw if the number of <b>constant</b> tags is different from english version.'; - -$error['nbTipTag']['head'] = 'Tip tag'; -$error['nbTipTag']['desc'] = 'Throw if the number of <b>tip</b> tags is different from english version.'; - $error['nbEntryTag']['head'] = 'Entry tag'; $error['nbEntryTag']['desc'] = 'Throw if the number of <b>entry</b> tags is different from english version.'; -$error['nbCommandTag']['head'] = 'Command tag'; -$error['nbCommandTag']['desc'] = 'Throw if the number of <b>command</b> tags is different from english version.'; - -$error['nbEmphasisTag']['head'] = 'Emphasis tag'; -$error['nbEmphasisTag']['desc'] = 'Throw if the number of <b>emphasis</b> tags is different from english version.'; - -$error['nbVarnameTag']['head'] = 'Varname tag'; -$error['nbVarnameTag']['desc'] = 'Throw if the number of <b>varname</b> tags is different from english version.'; - $error['errorFieldsynopsisInitializer']['head'] = 'Fieldsynopsis tag'; $error['errorFieldsynopsisInitializer']['desc'] = 'Throw if the value of the <b>initializer</b> tags is different from english version.'; $error['errorFieldsynopsisModifier']['head'] = 'Fieldsynopsis tag'; @@ -163,18 +157,6 @@ $error['attributXlinkLink']['head'] = 'Linkend and xlink tags'; $error['attributXlinkLink']['desc'] = 'Throw if the value of the attribut <b>xlink:href</b> is different from english version.'; -$error['nbLiteralTag']['head'] = 'Literal tag'; -$error['nbLiteralTag']['desc'] = 'Throw if the number of <b>literal</b> tags is different from english version.'; - -$error['nbProductnameTag']['head'] = 'Productname tag'; -$error['nbProductnameTag']['desc'] = 'Throw if the number of <b>productname</b> tags is different from english version.'; - -$error['nbFilenameTag']['head'] = 'Filename tag'; -$error['nbFilenameTag']['desc'] = 'Throw if the number of <b>filename</b> tags is different from english version.'; - -$error['nbAbbrevTag']['head'] = 'Abbrev tag'; -$error['nbAbbrevTag']['desc'] = 'Throw if the number of <b>abbrev</b> tags is different from english version.'; - $error['errorRoleMethodsynopsis']['head'] = 'Methodsynopsis tag'; $error['errorRoleMethodsynopsis']['desc'] = 'Throw if the value of the attribut <b>role</b> is different from english version.'; $error['errorOptionalMethodsynopsis']['head'] = 'Methodsynopsis tag'; @@ -192,17 +174,11 @@ $error['errorMethodnameMethodsynopsis']['head'] = 'Methodsynopsis tag'; $error['errorMethodnameMethodsynopsis']['desc'] = 'Throw if the value of the <b>methodname</b> tags is different from english version.'; -$error['nbNoteTag']['head'] = 'Note tag'; -$error['nbNoteTag']['desc'] = 'Throw if the number of <b>note</b> tags is different from english version.'; - $error['errorNbOoclassClassname']['head'] = 'Ooclass tag'; $error['errorNbOoclassClassname']['desc'] = 'Throw if the number of <b>classname</b> tags is different from english version.'; $error['errorOoclassClassname']['head'] = 'Ooclass tag'; $error['errorOoclassClassname']['desc'] = 'Throw if the value of the <b>classname</b> tags is different from english version.'; -$error['nbParaTag']['head'] = 'Para tag'; -$error['nbParaTag']['desc'] = 'Throw if the number of <b>para</b> tags is different from english version.'; - $error['attributXmlNsXlinkPreface']['head'] = 'Preface tag'; $error['attributXmlNsXlinkPreface']['desc'] = 'Throw if the value of the attribut <b>xmlns:xlink</b> is different from english version.'; $error['attributXmlNsPreface']['head'] = 'Preface tag'; @@ -247,9 +223,9 @@ $error['attributXmlNsXlinkSection']['head'] = 'Section tag'; $error['attributXmlNsXlinkSection']['desc'] = 'Throw if the value of the attribut <b>xmlns:xlink</b> is different from english version.'; -$error['attributXmlNsSection']['head'] = 'section tag'; +$error['attributXmlNsSection']['head'] = 'Section tag'; $error['attributXmlNsSection']['desc'] = 'Throw if the value of the attribut <b>xmlns</b> is different from english version.'; -$error['attributXmlIdSection']['head'] = 'section tag'; +$error['attributXmlIdSection']['head'] = 'Section tag'; $error['attributXmlIdSection']['desc'] = 'Throw if the value of the attribut <b>xml:id</b> is different from english version.'; $error['nbSeeAlsoMember']['head'] = 'SeeAlso section'; @@ -261,12 +237,12 @@ $error['nbTheadTag']['head'] = 'Thead tag'; $error['nbTheadTag']['desc'] = 'Throw if the number of <b>thead</b> tags is different from english version.'; -$error['attributXmlIdVarlistentry']['head'] = 'varlistentry tag'; +$error['attributXmlIdVarlistentry']['head'] = 'Varlistentry tag'; $error['attributXmlIdVarlistentry']['desc'] = 'Throw if the value of the attribut <b>xml:id</b> is different from english version.'; $to_display = array(); -// Si $error_to_display est un array vide, on lui attribut toutes les erreurs (page par d�faut) +// If $error_to_display is an emty array, we add it all errors (default page) if( empty($error_to_display) ) { while (list($k, $v) = each($error)) { $type[] = $k; @@ -279,13 +255,15 @@ for( $i=0; $i < count($type); $i++ ) { $to_display[$error[$type[$i]]['head']][$type[$i]]['desc'] = $error[$type[$i]]['desc']; -} // Fin for +} // Display title if( $fileLibel ) { echo '<h1 class="error-type-title">Check for errors in '.$fileLibel.'</h1>'; } +ksort($to_display); + while (list($k, $v) = each($to_display)) { if( $k == '- No error -' && empty($error_to_display) ) { continue; }
http://cvs.php.net/viewvc.cgi/doc-editor/php/ToolsError.php?r1=1.7&r2=1.8&diff_format=u Index: doc-editor/php/ToolsError.php diff -u doc-editor/php/ToolsError.php:1.7 doc-editor/php/ToolsError.php:1.8 --- doc-editor/php/ToolsError.php:1.7 Sun Apr 19 18:15:21 2009 +++ doc-editor/php/ToolsError.php Mon Apr 20 16:26:51 2009 @@ -318,25 +318,10 @@ $this->attributVarlistentryTag(); $this->classsynopsis(); $this->methodsynopsis(); - $this->nbAcronymTag(); - $this->nbAbbrevTag(); - $this->nbCautionTag(); $this->nbCdataTag(); - $this->nbChapterTag(); - $this->nbCommandTag(); - $this->nbConstantTag(); $this->nbElInTable(); - $this->nbEmphasisTag(); - $this->nbFilenameTag(); - $this->nbLiteralTag(); $this->nbMemberInSeeAlso(); - $this->nbNoteTag(); - $this->nbParaTag(); - $this->nbProductnameTag(); - $this->nbSimparaTag(); - $this->nbTipTag(); - $this->nbVarnameTag(); - $this->nbWarningTag(); + $this->nbTag(); $this->spaceOrPeriodRefpurposeTag(); } @@ -1208,497 +1193,59 @@ } /** - * Check Nb <para> tag + * Check Nb <*> tag * Add an entry into the error's stack if an error is found * */ - function nbParaTag() + function nbTag() { - $reg = '/<para(( )(.*?))?>/s'; - - $match = array(); - preg_match_all($reg, $this->en_content, $match); - $en_para = count($match[0]); - - $match = array(); - preg_match_all($reg, $this->lang_content, $match); - $lang_para = count($match[0]); - - if ($en_para != $lang_para) { - $this->addError(array( - 'value_en' => $en_para, - 'value_lang' => $lang_para, - 'type' => 'nbParaTag' - )); - - } - } - - /** - * Check Nb <note> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbNoteTag() - { - - $reg = '/<note>/s'; - - $en_note = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_note = count($match[0]); - } - - $lang_note = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_note = count($match[0]); - } - - if ($en_note != $lang_note) { - $this->addError(array( - "value_en" => $en_note, - "value_lang" => $lang_note, - "type" => "nbNoteTag" - )); - - } - } - - /** - * Check Nb <chapter> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbChapterTag() - { - - $reg = '/<chapter /s'; - - $en_chapter = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_chapter = count($match[0]); - } - - $lang_chapter = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_chapter = count($match[0]); - } - - if ($en_chapter != $lang_chapter ) { - $this->addError(array( - "value_en" => $en_chapter, - "value_lang" => $lang_chapter, - "type" => "nbChapterTag" - )); - } - } - - /** - * Check Nb <caution> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbCautionTag() - { - - $reg = '/<caution>/s'; - - $en_Caution = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_Caution = count($match[0]); - } - - $lang_Caution = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_Caution = count($match[0]); - } - - if ($en_Caution != $lang_Caution ) { - $this->addError(array( - "value_en" => $en_Caution, - "value_lang" => $lang_Caution, - "type" => "nbCautionTag" - )); - } - } - - /** - * Check Nb <filename> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbFilenameTag() - { - - $reg = '/<filename>/s'; - - $en_filename = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_filename = count($match[0]); - } - - $lang_filename = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_filename = count($match[0]); - } - - if ($en_filename != $lang_filename ) { - $this->addError(array( - "value_en" => $en_filename, - "value_lang" => $lang_filename, - "type" => "nbFilenameTag" - )); - } - } - - /** - * Check Nb <abbrev> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbAbbrevTag() - { - - $reg = '/<abbrev>/s'; - - $en_abbrev = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_abbrev = count($match[0]); - } - - $lang_abbrev = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_abbrev = count($match[0]); - } - - if ($en_abbrev != $lang_abbrev ) { - $this->addError(array( - "value_en" => $en_abbrev, - "value_lang" => $lang_abbrev, - "type" => "nbAbbrevTag" - )); - } - } - - /** - * Check Nb <productname> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbProductnameTag() - { - - $reg = '/<productname>/s'; - - $en_productname = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_productname = count($match[0]); - } - - $lang_productname = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_productname = count($match[0]); - } - - if ($en_productname != $lang_productname ) { - $this->addError(array( - "value_en" => $en_productname, - "value_lang" => $lang_productname, - "type" => "nbProductnameTag" - )); - } - } - - /** - * Check Nb <acronym> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbAcronymTag() - { - - $reg = '/<acronym>/s'; - - $en_acronym = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_acronym = count($match[0]); - } - - $lang_acronym = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_acronym = count($match[0]); - } - - if ($en_acronym != $lang_acronym ) { - $this->addError(array( - "value_en" => $en_acronym, - "value_lang" => $lang_acronym, - "type" => "nbAcronymTag" - )); - } - } - - /** - * Check Nb <constant> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbConstantTag() - { - - $reg = '/<constant>/s'; - - $en_constant = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_constant = count($match[0]); - } - - $lang_constant = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_constant = count($match[0]); - } - - if ($en_constant != $lang_constant ) { - $this->addError(array( - "value_en" => $en_constant, - "value_lang" => $lang_constant, - "type" => "nbConstantTag" - )); - } - } - - /** - * Check Nb <warning> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbWarningTag() - { - - $reg = '/<warning>/s'; - - $en_warning = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_warning = count($match[0]); - } - - $lang_warning = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_warning = count($match[0]); - } - - if ($en_warning != $lang_warning ) { - $this->addError(array( - "value_en" => $en_warning, - "value_lang" => $lang_warning, - "type" => "nbWarningTag" - )); - } - } - - /** - * Check Nb <simpara> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbSimparaTag() - { - - $reg = '/<simpara>/s'; - - $en_simpara = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_simpara = count($match[0]); - } - - $lang_simpara = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_simpara = count($match[0]); - } - - if ($en_simpara != $lang_simpara ) { - $this->addError(array( - "value_en" => $en_simpara, - "value_lang" => $lang_simpara, - "type" => "nbSimparaTag" - )); - } - } - - /** - * Check Nb <tip> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbTipTag() - { - - $reg = '/<tip>/s'; - - $en_tip = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_tip = count($match[0]); - } - - $lang_tip = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_tip = count($match[0]); - } - - if ($en_tip != $lang_tip ) { - $this->addError(array( - "value_en" => $en_tip, - "value_lang" => $lang_tip, - "type" => "nbTipTag" - )); - } - } - - /** - * Check Nb <varname> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbVarnameTag() - { - - $reg = '/<varname>/s'; - - $en_varname = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_varname = count($match[0]); - } - - $lang_varname = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_varname = count($match[0]); - } - - if ($en_varname != $lang_varname ) { - $this->addError(array( - "value_en" => $en_varname, - "value_lang" => $lang_varname, - "type" => "nbVarnameTag" - )); - } - } - - /** - * Check Nb <emphasis> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbEmphasisTag() - { - - $reg = '/<emphasis>/s'; - - $en_emphasis = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_emphasis = count($match[0]); - } - - $lang_emphasis = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_emphasis = count($match[0]); - } - - if ($en_emphasis != $lang_emphasis ) { - $this->addError(array( - "value_en" => $en_emphasis, - "value_lang" => $lang_emphasis, - "type" => "nbEmphasisTag" - )); - } - } - - /** - * Check Nb <command> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbCommandTag() - { - - $reg = '/<command>/s'; - - $en_command = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_command = count($match[0]); - } + // When you add a new tag here, you must add it too into error_type.php files (array => tags) + $tags = array( + 'abbrev' => 'Abbrev', + 'acronym' => 'Acronym', + 'caution' => 'Caution', + 'command' => 'Command', + 'chapter' => 'Chapter', + 'constant' => 'Constant', + 'emphasis' => 'Emphasis', + 'filename' => 'Filename', + 'literal' => 'Literal', + 'note' => 'Note', + 'para' => 'Para', + 'productname' => 'Productname', + 'simpara' => 'Simpara', + 'tip' => 'Tip', + 'varname' => 'Varname', + 'warning' => 'Warning' + ); - $lang_command = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_command = count($match[0]); - } + foreach ($tags as $tag => $label) { - if ($en_command != $lang_command ) { - $this->addError(array( - "value_en" => $en_command, - "value_lang" => $lang_command, - "type" => "nbCommandTag" - )); - } - } + $reg = '/<' . $tag . ' /s'; - /** - * Check Nb <literal> tag - * Add an entry into the error's stack if an error is found - * - */ - function nbLiteralTag() - { + $nb_en = 0; + $match = array(); + if (preg_match_all($reg, $this->en_content, $match)) { + $nb_en = count($match[0]); + } - $reg = '/<literal>/s'; + $nb_lang = 0; + $match = array(); + if (preg_match_all($reg, $this->lang_content, $match)) { + $nb_lang = count($match[0]); + } - $en_literal = 0; - $match = array(); - if (preg_match_all($reg, $this->en_content, $match)) { - $en_literal = count($match[0]); - } + if ($nb_en != $nb_lang ) { + $this->addError(array( + "value_en" => $nb_en, + "value_lang" => $nb_lang, + "type" => "nb" . $label . "Tag" + )); + } - $lang_literal = 0; - $match = array(); - if (preg_match_all($reg, $this->lang_content, $match)) { - $lang_literal = count($match[0]); - } + } // foreach - if ($en_literal != $lang_literal ) { - $this->addError(array( - "value_en" => $en_literal, - "value_lang" => $lang_literal, - "type" => "nbLiteralTag" - )); - } } /** @@ -1784,6 +1331,7 @@ $match = array(); $en_seeAlsoMember = 0; preg_match($reg, $this->en_content, $match); + if (isset($match[1])) { $match2 = array(); preg_match_all($reg2, $match[1], $match2); @@ -1795,6 +1343,7 @@ $match = array(); $lang_seeAlsoMember = 0; preg_match($reg, $this->lang_content, $match); + if (isset($match[1])) { $match2 = array(); preg_match_all($reg2, $match[1], $match2); http://cvs.php.net/viewvc.cgi/doc-editor/error_type.php?r1=1.10&r2=1.11&diff_format=u Index: doc-editor/error_type.php diff -u doc-editor/error_type.php:1.10 doc-editor/error_type.php:1.11 --- doc-editor/error_type.php:1.10 Sun Apr 19 18:15:21 2009 +++ doc-editor/error_type.php Mon Apr 20 16:26:51 2009 @@ -21,12 +21,6 @@ $fileLibel = NULL; } -/* -echo '<pre>'; -print_r($error_to_display); -echo '</pre>'; -*/ - ?> <style type="text/css"> @@ -87,6 +81,33 @@ <?php +// Commun number of tags check + +$tags = array( + 'abbrev' => 'Abbrev', + 'acronym' => 'Acronym', + 'caution' => 'Caution', + 'command' => 'Command', + 'chapter' => 'Chapter', + 'constant' => 'Constant', + 'emphasis' => 'Emphasis', + 'filename' => 'Filename', + 'literal' => 'Literal', + 'note' => 'Note', + 'para' => 'Para', + 'productname' => 'Productname', + 'simpara' => 'Simpara', + 'tip' => 'Tip', + 'varname' => 'Varname', + 'warning' => 'Warning' +); + +foreach ($tags as $tag => $label) +{ + $error['nb' . $label . 'Tag']['head'] = $label . ' tag'; + $error['nb' . $label . 'Tag']['desc'] = 'Throw if the number of <b>' . $label . '</b> tags is different from english version.'; +} + $error['-No error-']['head'] = '- No error -'; $error['-No error-']['desc'] = 'There is no more error in this file.'; @@ -117,36 +138,9 @@ $error['attributVersionChapter']['head'] = 'Chapter tag'; $error['attributVersionChapter']['desc'] = 'Throw if the value of the attribut <b>version</b> is different from english version.'; -$error['nbChapterTag']['head'] = 'Chapter tag'; -$error['nbChapterTag']['desc'] = 'Throw if the number of <b>chapter</b> tags is different from english version.'; - -$error['nbSimparaTag']['head'] = 'Simpara tag'; -$error['nbSimparaTag']['desc'] = 'Throw if the number of <b>simpara</b> tags is different from english version.'; - -$error['nbCautionTag']['head'] = 'Caution tag'; -$error['nbCautionTag']['desc'] = 'Throw if the number of <b>caution</b> tags is different from english version.'; - -$error['nbAcronymTag']['head'] = 'Acronym tag'; -$error['nbAcronymTag']['desc'] = 'Throw if the number of <b>acronym</b> tags is different from english version.'; - -$error['nbConstantTag']['head'] = 'Constant tag'; -$error['nbConstantTag']['desc'] = 'Throw if the number of <b>constant</b> tags is different from english version.'; - -$error['nbTipTag']['head'] = 'Tip tag'; -$error['nbTipTag']['desc'] = 'Throw if the number of <b>tip</b> tags is different from english version.'; - $error['nbEntryTag']['head'] = 'Entry tag'; $error['nbEntryTag']['desc'] = 'Throw if the number of <b>entry</b> tags is different from english version.'; -$error['nbCommandTag']['head'] = 'Command tag'; -$error['nbCommandTag']['desc'] = 'Throw if the number of <b>command</b> tags is different from english version.'; - -$error['nbEmphasisTag']['head'] = 'Emphasis tag'; -$error['nbEmphasisTag']['desc'] = 'Throw if the number of <b>emphasis</b> tags is different from english version.'; - -$error['nbVarnameTag']['head'] = 'Varname tag'; -$error['nbVarnameTag']['desc'] = 'Throw if the number of <b>varname</b> tags is different from english version.'; - $error['errorFieldsynopsisInitializer']['head'] = 'Fieldsynopsis tag'; $error['errorFieldsynopsisInitializer']['desc'] = 'Throw if the value of the <b>initializer</b> tags is different from english version.'; $error['errorFieldsynopsisModifier']['head'] = 'Fieldsynopsis tag'; @@ -163,18 +157,6 @@ $error['attributXlinkLink']['head'] = 'Linkend and xlink tags'; $error['attributXlinkLink']['desc'] = 'Throw if the value of the attribut <b>xlink:href</b> is different from english version.'; -$error['nbLiteralTag']['head'] = 'Literal tag'; -$error['nbLiteralTag']['desc'] = 'Throw if the number of <b>literal</b> tags is different from english version.'; - -$error['nbProductnameTag']['head'] = 'Productname tag'; -$error['nbProductnameTag']['desc'] = 'Throw if the number of <b>productname</b> tags is different from english version.'; - -$error['nbFilenameTag']['head'] = 'Filename tag'; -$error['nbFilenameTag']['desc'] = 'Throw if the number of <b>filename</b> tags is different from english version.'; - -$error['nbAbbrevTag']['head'] = 'Abbrev tag'; -$error['nbAbbrevTag']['desc'] = 'Throw if the number of <b>abbrev</b> tags is different from english version.'; - $error['errorRoleMethodsynopsis']['head'] = 'Methodsynopsis tag'; $error['errorRoleMethodsynopsis']['desc'] = 'Throw if the value of the attribut <b>role</b> is different from english version.'; $error['errorOptionalMethodsynopsis']['head'] = 'Methodsynopsis tag'; @@ -192,17 +174,11 @@ $error['errorMethodnameMethodsynopsis']['head'] = 'Methodsynopsis tag'; $error['errorMethodnameMethodsynopsis']['desc'] = 'Throw if the value of the <b>methodname</b> tags is different from english version.'; -$error['nbNoteTag']['head'] = 'Note tag'; -$error['nbNoteTag']['desc'] = 'Throw if the number of <b>note</b> tags is different from english version.'; - $error['errorNbOoclassClassname']['head'] = 'Ooclass tag'; $error['errorNbOoclassClassname']['desc'] = 'Throw if the number of <b>classname</b> tags is different from english version.'; $error['errorOoclassClassname']['head'] = 'Ooclass tag'; $error['errorOoclassClassname']['desc'] = 'Throw if the value of the <b>classname</b> tags is different from english version.'; -$error['nbParaTag']['head'] = 'Para tag'; -$error['nbParaTag']['desc'] = 'Throw if the number of <b>para</b> tags is different from english version.'; - $error['attributXmlNsXlinkPreface']['head'] = 'Preface tag'; $error['attributXmlNsXlinkPreface']['desc'] = 'Throw if the value of the attribut <b>xmlns:xlink</b> is different from english version.'; $error['attributXmlNsPreface']['head'] = 'Preface tag'; @@ -247,9 +223,9 @@ $error['attributXmlNsXlinkSection']['head'] = 'Section tag'; $error['attributXmlNsXlinkSection']['desc'] = 'Throw if the value of the attribut <b>xmlns:xlink</b> is different from english version.'; -$error['attributXmlNsSection']['head'] = 'section tag'; +$error['attributXmlNsSection']['head'] = 'Section tag'; $error['attributXmlNsSection']['desc'] = 'Throw if the value of the attribut <b>xmlns</b> is different from english version.'; -$error['attributXmlIdSection']['head'] = 'section tag'; +$error['attributXmlIdSection']['head'] = 'Section tag'; $error['attributXmlIdSection']['desc'] = 'Throw if the value of the attribut <b>xml:id</b> is different from english version.'; $error['nbSeeAlsoMember']['head'] = 'SeeAlso section'; @@ -261,12 +237,12 @@ $error['nbTheadTag']['head'] = 'Thead tag'; $error['nbTheadTag']['desc'] = 'Throw if the number of <b>thead</b> tags is different from english version.'; -$error['attributXmlIdVarlistentry']['head'] = 'varlistentry tag'; +$error['attributXmlIdVarlistentry']['head'] = 'Varlistentry tag'; $error['attributXmlIdVarlistentry']['desc'] = 'Throw if the value of the attribut <b>xml:id</b> is different from english version.'; $to_display = array(); -// Si $error_to_display est un array vide, on lui attribut toutes les erreurs (page par d�faut) +// If $error_to_display is an emty array, we add it all errors (default page) if( empty($error_to_display) ) { while (list($k, $v) = each($error)) { $type[] = $k; @@ -279,13 +255,15 @@ for( $i=0; $i < count($type); $i++ ) { $to_display[$error[$type[$i]]['head']][$type[$i]]['desc'] = $error[$type[$i]]['desc']; -} // Fin for +} // Display title if( $fileLibel ) { echo '<h1 class="error-type-title">Check for errors in '.$fileLibel.'</h1>'; } +ksort($to_display); + while (list($k, $v) = each($to_display)) { if( $k == '- No error -' && empty($error_to_display) ) { continue; }