[GRASS-SVN] r66519 - in grass-addons/tools/addons: . test test/data

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 16 13:08:21 PDT 2015


Author: wenzeslaus
Date: 2015-10-16 13:08:21 -0700 (Fri, 16 Oct 2015)
New Revision: 66519

Added:
   grass-addons/tools/addons/test/data/r.group.page.with.toc.html
Modified:
   grass-addons/tools/addons/get_page_description.py
   grass-addons/tools/addons/test/test_description_extraction.sh
Log:
match the actual headings not just any text

This fixes r66518 which was matching TOC and then considering part of it as text to show.


Modified: grass-addons/tools/addons/get_page_description.py
===================================================================
--- grass-addons/tools/addons/get_page_description.py	2015-10-16 19:14:06 UTC (rev 66518)
+++ grass-addons/tools/addons/get_page_description.py	2015-10-16 20:08:21 UTC (rev 66519)
@@ -62,8 +62,8 @@
         desc_section_num_lines = 0
         desc_block_start = re.compile(r'NAME')
         # the incomplete manual pages have NAME followed by DESCRIPTION
-        desc_block_end = re.compile(r'KEYWORDS|DESCRIPTION')
-        desc_section_start = re.compile(r'DESCRIPTION')
+        desc_block_end = re.compile(r'<h2.*>(KEYWORDS|DESCRIPTION).*/h.>')
+        desc_section_start = re.compile(r'<h2.*>DESCRIPTION.*/h.>')
         desc_line = re.compile(r' - ')
         comment_meta_desc_line = re.compile(r'<!-- meta page description:.*-->')
         for line in page_file:

Copied: grass-addons/tools/addons/test/data/r.group.page.with.toc.html (from rev 66517, grass-addons/tools/addons/test/data/r.group.page.html)
===================================================================
--- grass-addons/tools/addons/test/data/r.group.page.with.toc.html	                        (rev 0)
+++ grass-addons/tools/addons/test/data/r.group.page.with.toc.html	2015-10-16 20:08:21 UTC (rev 66519)
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>GRASS GIS Manual (test page): r.group.page</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+<body>
+
+<hr class="header">
+
+<h2>NAME</h2>
+<em><b>r.group.page.with.toc</b></em>
+<div class="toc">
+<h4 class="toc">Table of contents</h4>
+<ul class="toc">
+    <li class="toc"><a href="#description" class="toc">DESCRIPTION</a></li>
+    <li class="toc"><a href="#see-also" class="toc">SEE ALSO</a></li>
+    <li class="toc"><a href="#author" class="toc">AUTHORS</a></li>
+</ul>
+</div>
+<h2>DESCRIPTION</h2>
+
+This is a test page which should be similar to a manual page of a group
+of modules which has toc. Example can be r.modis which is not a module but
+it has its own page which links to r.modis.download and r.modis.import.
+
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a href="wxGUI.components.html">wxGUI components</a><br>
+</em>
+
+<h2>AUTHORS</h2>
+
+Random Author
+
+<p>
+<i>Data placeholder: 2015-09-06 (Sun, 06 Sep 2015)</i><hr class="header">
+<p>
+<a href="index.html">Main index</a>
+<p>
+© 2003-2015
+<a href="http://grass.osgeo.org">GRASS Development Team</a>,
+GRASS GIS x.x Reference Manual (test page)
+</p>
+
+</body>
+</html>

Modified: grass-addons/tools/addons/test/test_description_extraction.sh
===================================================================
--- grass-addons/tools/addons/test/test_description_extraction.sh	2015-10-16 19:14:06 UTC (rev 66518)
+++ grass-addons/tools/addons/test/test_description_extraction.sh	2015-10-16 20:08:21 UTC (rev 66519)
@@ -6,6 +6,7 @@
 python -m doctest ../get_page_description.py
 ../get_page_description.py data/r.standard.example.html
 ../get_page_description.py data/r.group.page.html
+../get_page_description.py data/r.group.page.with.toc.html
 ../get_page_description.py data/wxGUI.example.html
 ../get_page_description.py data/g.broken.example.html
 ../get_page_description.py data/g.no.keywords.html



More information about the grass-commit mailing list