[GRASS-SVN] r62765 - in grass/trunk: general/g.parser tools

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 17 03:08:22 PST 2014


Author: martinl
Date: 2014-11-17 03:08:21 -0800 (Mon, 17 Nov 2014)
New Revision: 62765

Modified:
   grass/trunk/general/g.parser/g.parser.html
   grass/trunk/tools/mkhtml.py
Log:
g.parser: generate header & footer


Modified: grass/trunk/general/g.parser/g.parser.html
===================================================================
--- grass/trunk/general/g.parser/g.parser.html	2014-11-17 10:27:29 UTC (rev 62764)
+++ grass/trunk/general/g.parser/g.parser.html	2014-11-17 11:08:21 UTC (rev 62765)
@@ -1,19 +1,6 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>GRASS GIS manual: g.parser</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="grassdocs.css" type="text/css">
-</head>
-<body bgcolor="white">
+<!-- meta page name: g.parser -->
+<!-- meta page name description: Provides full parser support for GRASS scripts. -->
 
-<img src="grass_logo.png" alt="GRASS logo">
-<hr class="header">
-
-<h2>NAME</h2>
-<em><b>g.parser</b></em> - Provides full parser support for GRASS
-scripts.
-
 <h2>SYNOPSIS</h2>
 <b>g.parser --help</b><br>
 <b>g.parser</b> [-<b>s</b>] [-<b>t</b>] <em>filename</em> [<em>argument</em>,...]
@@ -445,9 +432,10 @@
   <a href="g.tempfile.html">g.tempfile</a>
 </em>
 
-and <a href="http://svn.osgeo.org/grass/grass/trunk/SUBMITTING_PYTHON">SUBMITTING_PYTHON</a>
-file in the GRASS source code.
 <p>
+<a href="http://trac.osgeo.org/grass/wiki/Submitting/Python">Submitting rules for Python</a>
+
+<p>
 Related Wiki pages:
 <a href="http://grasswiki.osgeo.org/wiki/Category:Linking_to_other_languages">Using GRASS with other programming languages</a>
 
@@ -457,9 +445,3 @@
 
 <p>
 <i>Last changed: $Date$</i>
-
-<hr class="header">
-<p><a href="index.html">Main index</a> | <a href="full_index.html">Full index</a></p>
-<p>© 2003-2014 <a href="http://grass.osgeo.org">GRASS Development Team</a>, GRASS GIS 7.0.svn Reference Manual</p>
-</body>
-</html>

Modified: grass/trunk/tools/mkhtml.py
===================================================================
--- grass/trunk/tools/mkhtml.py	2014-11-17 10:27:29 UTC (rev 62764)
+++ grass/trunk/tools/mkhtml.py	2014-11-17 11:08:21 UTC (rev 62765)
@@ -49,6 +49,10 @@
 <em><b>${PGM}</b></em>
 """
 
+header_pgm_desc = """<h2>NAME</h2>
+<em><b>${PGM}</b></em> - ${PGM_DESC}
+"""
+
 footer_index = string.Template(\
 """<hr class="header">
 <p><a href="index.html">Main index</a> | <a href="${INDEXNAME}.html">${INDEXNAMECAP} index</a> | <a href="topics.html">Topics index</a> | <a href="keywords.html">Keywords Index</a> | <a href="full_index.html">Full index</a></p>
@@ -181,20 +185,27 @@
 # process header
 src_data = read_file(src_file)
 name = re.search('(<!-- meta page name:)(.*)(-->)', src_data, re.IGNORECASE)
+pgm_desc = None
 if name:
     pgm = name.group(2).strip().split('-', 1)[0].strip()
+    name_desc = re.search('(<!-- meta page name description:)(.*)(-->)', src_data, re.IGNORECASE)
+    if name_desc:
+        pgm_desc = name_desc.group(2).strip()
 desc = re.search('(<!-- meta page description:)(.*)(-->)', src_data,
                  re.IGNORECASE)
 if desc:
     pgm = desc.group(2).strip()
     header_tmpl = string.Template(header_base + header_nopgm)
 else:
-    header_tmpl = string.Template(header_base + header_pgm)
+    if not pgm_desc:
+        header_tmpl = string.Template(header_base + header_pgm)
+    else:
+        header_tmpl = string.Template(header_base + header_pgm_desc)
 
 if not re.search('<html>', src_data, re.IGNORECASE):
     tmp_data = read_file(tmp_file)
     if not re.search('<html>', tmp_data, re.IGNORECASE):
-        sys.stdout.write(header_tmpl.substitute(PGM=pgm))
+        sys.stdout.write(header_tmpl.substitute(PGM=pgm, PGM_DESC=pgm_desc))
     if tmp_data:
         for line in tmp_data.splitlines(True):
             if not re.search('</body>|</html>', line, re.IGNORECASE):



More information about the grass-commit mailing list