cvs: doc-editor / error_type.php /php ToolsError.php
| From: | Yannick Torres | Date: | Sat, 16 May 2009 20:36:20 +0000 |
| Subject: | cvs: doc-editor / error_type.php /php ToolsError.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-4024@lists.php.net to get a copy of this message | ||
yannick Sat May 16 20:36:20 2009 UTC
Modified files:
/doc-editor/php ToolsError.php
/doc-editor error_type.php
Log:
- add <xref> tag check
http://cvs.php.net/viewvc.cgi/doc-editor/php/ToolsError.php?r1=1.13&r2=1.14&diff_format=u
Index: doc-editor/php/ToolsError.php
diff -u doc-editor/php/ToolsError.php:1.13 doc-editor/php/ToolsError.php:1.14
--- doc-editor/php/ToolsError.php:1.13 Sat May 9 21:00:55 2009
+++ doc-editor/php/ToolsError.php Sat May 16 20:36:20 2009
@@ -304,6 +304,7 @@
$this->attributBookTag();
$this->attributChapterTag();
$this->attributLinkTag();
+ $this->attributXrefTag();
$this->attributPrefaceTag();
$this->attributQandaentryTag();
$this->attributRefsec1Tag();
@@ -477,6 +478,46 @@
}
/**
+ * Check attributs in Xref tag
+ * Add an entry into the error's stack if an error is found
+ *
+ */
+ function attributXrefTag()
+ {
+
+ $reg = '/<xref\s*?linkend=\s*?"(.[^"]*?)"\s*\/>/s';
+
+ $match = $en_xref = array();
+ preg_match_all($reg, $this->en_content, $match);
+ $en_xref = $match[1];
+
+ $match = $lang_xref = array();
+ preg_match_all($reg, $this->lang_content, $match);
+ $lang_xref = $match[1];
+
+ for ($i = 0; $i < count($en_xref); $i++) {
+
+ if (!isset($lang_xref[$i])) { $lang_xref[$i] = ''; }
+
+ if( !in_array($en_xref[$i], $lang_xref) || $lang_xref[$i] == '' ) {
+ $this->addError(array(
+ "value_en" => $en_xref[$i],
+ "value_lang" => $lang_xref[$i],
+ "type" => "attributLinkendXref"
+ ));
+ }
+ }
+
+ if( count($en_xref) < count($lang_xref) ) {
+ $this->addError(array(
+ "value_en" => count($en_xref),
+ "value_lang" => count($lang_xref),
+ "type" => "NbXref"
+ ));
+ }
+ }
+
+ /**
* Check attributs in Link tag
* Add an entry into the error's stack if an error is found
*
@@ -515,7 +556,7 @@
$this->addError(array(
"value_en" => count($en_xlink),
"value_lang" => count($lang_xlink),
- "type" => "NbLink"
+ "type" => "NbXlinkLink"
));
}
http://cvs.php.net/viewvc.cgi/doc-editor/error_type.php?r1=1.13&r2=1.14&diff_format=u
Index: doc-editor/error_type.php
diff -u doc-editor/error_type.php:1.13 doc-editor/error_type.php:1.14
--- doc-editor/error_type.php:1.13 Sat May 9 21:00:56 2009
+++ doc-editor/error_type.php Sat May 16 20:36:20 2009
@@ -158,8 +158,13 @@
$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['NbLink']['head'] = 'Linkend and xlink tags';
-$error['NbLink']['desc'] = 'Throw if the number of <b>Link</b>
tags is different from english version.';
+$error['NbXlinkLink']['head'] = 'Linkend and xlink tags';
+$error['NbXlinkLink']['desc'] = 'Throw if the number of
<b>Link</b> tags is different from english version.';
+
+$error['NbXref']['head'] = 'Xref tags';
+$error['NbXref']['desc'] = 'Throw if the number of <b>Xref</b>
tags is different from english version.';
+$error['attributLinkendXref']['head'] = 'Xref tags';
+$error['attributLinkendXref']['desc'] = 'Throw if the value of the
attribut <b>linkend</b> 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.';