help3/xhpeditor/index.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
New commits: commit d01f0d755209d4fb83ff5069b4665a22c92bd1a1 Author: Olivier Hallot <[email protected]> AuthorDate: Sat Jan 4 11:23:35 2020 -0300 Commit: Olivier Hallot <[email protected]> CommitDate: Sat Jan 4 16:00:12 2020 +0100 xhpeditor: Add duplicate ID check for XHP Add check of duplicated id for - paragraph, - headings ('-6) -and notes, tips, warning Change-Id: I10049bda08f03cc940d1678253fbee8f80996d11 Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/86221 Reviewed-by: Olivier Hallot <[email protected]> Tested-by: Olivier Hallot <[email protected]> diff --git a/help3/xhpeditor/index.php b/help3/xhpeditor/index.php index 9ccfb17..d6a73a4 100644 --- a/help3/xhpeditor/index.php +++ b/help3/xhpeditor/index.php @@ -43,7 +43,7 @@ $xhp = $_POST["xhpdoc"]; <input type="submit" name="open_master" value="Open Master"/> <textarea id="xhpeditor" name="xhpdoc" form="CMtextarea"><?php echo $xhp;?></textarea></br> </form> - <div class-"buttonsdiv"> + <div class="buttonsdiv"> <?php include './buttons.php';?> </div> </div> @@ -101,9 +101,26 @@ $xhp = $_POST["xhpdoc"]; }else{ echo '<p>This document verifies the DTD!</p>'; }; + echo "<h2>Check duplicated Id's:</h2>"; + $tags_id_uniq = array('paragraph','note','warning','tip','h1','h2','h3','h4','h5','h6'); + $xmlarray = simplexml_load_string($xhp); + $i=0; + foreach($tags_id_uniq as $tag_uniq) { + foreach ($xmlarray->xpath("//$tag_uniq") as $tag){ + $idarray[$i] = $tag['id']; + ++$i; + } + $dupped_array = array_values(array_unique(array_diff_key($idarray, array_unique($idarray)))); + if (count($dupped_array) > 0){ + echo '<p class="bug">Found duplicated ids:</p>'; + foreach($dupped_array as $dup) { + echo "<p>$dup</p>"; + } + }else{ + echo "<p>No duplicates ids found.</p>"; + } }elseif (isset($_POST["get_patch"])) { - echo '<h2>Get Patch:</h2>'; - echo "<p>get patch</p>"; + echo '<h2>Get Patch:</h2>'; } else { echo '<h2>Boo:</h2>'; echo '<p>Aha!!!!!</p>';} _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
