[GRASS-SVN] r62782 - in grass/branches/releasebranch_7_0: lib/gis man tools

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 17 15:40:40 PST 2014


Author: neteler
Date: 2014-11-17 15:40:40 -0800 (Mon, 17 Nov 2014)
New Revision: 62782

Modified:
   grass/branches/releasebranch_7_0/lib/gis/parser_html.c
   grass/branches/releasebranch_7_0/man/Makefile
   grass/branches/releasebranch_7_0/man/build_html.py
   grass/branches/releasebranch_7_0/man/grassdocs.css
   grass/branches/releasebranch_7_0/tools/mkhtml.py
Log:
doc: new style for manual pages (backport of trunk r61935 and subsequent updates)

Modified: grass/branches/releasebranch_7_0/lib/gis/parser_html.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/gis/parser_html.c	2014-11-17 23:28:57 UTC (rev 62781)
+++ grass/branches/releasebranch_7_0/lib/gis/parser_html.c	2014-11-17 23:40:40 UTC (rev 62782)
@@ -49,7 +49,8 @@
     fprintf(stdout,
 	    "<link rel=\"stylesheet\" href=\"grassdocs.css\" type=\"text/css\">\n");
     fprintf(stdout, "</head>\n");
-    fprintf(stdout, "<body bgcolor=\"white\">\n\n");
+    fprintf(stdout, "<body bgcolor=\"white\">\n");
+    fprintf(stdout, "<div id=\"container\">\n\n");
     fprintf(stdout,
 	    "<a href=\"index.html\"><img src=\"grass_logo.png\" alt=\"GRASS logo\"></a>\n");
     fprintf(stdout, "<hr class=\"header\">\n\n");

Modified: grass/branches/releasebranch_7_0/man/Makefile
===================================================================
--- grass/branches/releasebranch_7_0/man/Makefile	2014-11-17 23:28:57 UTC (rev 62781)
+++ grass/branches/releasebranch_7_0/man/Makefile	2014-11-17 23:40:40 UTC (rev 62782)
@@ -29,6 +29,13 @@
 
 ALL_HTML := $(wildcard $(HTMLDIR)/*.*.html)
 
+ifneq (@(type sphinx-build2 > /dev/null),)
+SPHINXBUILD   = sphinx-build2
+endif
+ifneq (@(type sphinx-build > /dev/null),)
+SPHINXBUILD   = sphinx-build
+endif
+
 default: $(DSTFILES)
 	@echo "Generating HTML manual pages index (help system)..."
 	$(MAKE) $(INDICES)
@@ -92,3 +99,4 @@
 
 $(HTMLDIR)/grass_icon.png: grass_icon.png
 	$(INSTALL_DATA) $< $@
+

Modified: grass/branches/releasebranch_7_0/man/build_html.py
===================================================================
--- grass/branches/releasebranch_7_0/man/build_html.py	2014-11-17 23:28:57 UTC (rev 62781)
+++ grass/branches/releasebranch_7_0/man/build_html.py	2014-11-17 23:40:40 UTC (rev 62782)
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 # utilities for generating HTML indices
-# (c) 2003-2006, 2009-2013 by the GRASS Development Team, Markus Neteler, Glynn Clements, Luca Delucchi
+# (c) 2003-2014 by the GRASS Development Team, Markus Neteler, Glynn Clements, Luca Delucchi
 
 import sys
 import os
@@ -49,7 +49,7 @@
 r""" <link rel="stylesheet" href="grassdocs.css" type="text/css">
 </head>
 <body style="width: ${body_width}">
-
+<div id="container">
 <!-- this file is generated by man/build_html.py -->
 
 <a href="index.html"><img src="grass_logo.png" alt="GRASS logo"></a>
@@ -75,24 +75,28 @@
 #"
 
 overview_tmpl = string.Template(\
-r"""<!-- the files grass7.html & helptext.html file live in lib/init/ -->
+r"""<!-- the files grass${grass_version_major}.html & helptext.html file live in lib/init/ -->
 
 <table align="center" border="0" cellspacing="8">
   <tbody>
     <tr>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3> Quick Introduction</h3>
+      <td width="33%" valign="top" class="box"><h3> Quick Introduction</h3>
       <ul>
        <li class="box"><a href="helptext.html">How to start with GRASS</a></li>
        <li class="box"><span>Index of <a href="topics.html">topics</a> and <a href="keywords.html">keywords</a></span></li>
       </ul>
-     <p>
+      <p>
       <ul>
        <li class="box"><a href="projectionintro.html">Intro: projections and spatial transformations</a></li>
       </ul>
+      <p>
+      <ul>
+       <li class="box"><span><a href="http://grasswiki.osgeo.org/wiki/Faq">FAQ - Frequently Asked Questions</a> (Wiki)</span></li>
+      </ul>
       </td>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3> Display/Graphical User Interfaces</h3>
+      <td width="33%" valign="top" class="box"><h3> Graphical User Interface</h3>
        <ul>
-        <li class="box"><span><a href="wxGUI.html">wxGUI</a> Graphical User Interface</span></li>
+        <li class="box"><span><a href="wxGUI.html">wxGUI</a></span></li>
         <li class="box"><a href="wxGUI.components.html">wxGUI components</a></li>
         <li class="box"><a href="wxGUI.toolboxes.html">wxGUI toolboxes</a></li>
        </ul>
@@ -100,15 +104,15 @@
        <ul>
         <li class="box"><a href="topic_gui.html">GUI commands</a></li>
        </ul>
-
+       <h3> Display</h3>
        <ul>
         <li class="box"><a href="display.html">Display commands manual</a></li>
         <li class="box"><a href="displaydrivers.html">Display drivers</a></li>
        </ul>
       </td>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3> General</h3>
+      <td width="33%" valign="top" class="box"><h3> General</h3>
        <ul>
-        <li class="box"><a href="grass7.html">GRASS GIS startup manual page</a></li>
+        <li class="box"><a href="grass${grass_version_major}.html">GRASS GIS startup manual</a></li>
         <li class="box"><a href="general.html">General commands manual</a></li>
        </ul>
         <h3> Addons</h3>
@@ -118,38 +122,38 @@
       </td>
     </tr>
     <tr>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3> Raster processing</h3>
+      <td width="33%" valign="top" class="box"><h3> Raster processing</h3>
        <ul>
         <li class="box"><a href="rasterintro.html">Intro: 2D raster map processing</a></li>
         <li class="box"><a href="raster.html">Raster commands manual</a></li>
        </ul>
       </td>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3> 3D raster processing</h3>
+      <td width="33%" valign="top" class="box"><h3> 3D raster processing</h3>
        <ul>
         <li class="box"><a href="raster3dintro.html">Intro: 3D raster map (voxel) processing</a></li>
         <li class="box"><a href="raster3D.html">3D raster (voxel) commands manual</a></li>
       </ul></td>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3> Image processing</h3>
+      <td width="33%" valign="top" class="box"><h3> Image processing</h3>
        <ul>
         <li class="box"><a href="imageryintro.html">Intro: image processing</a></li>
         <li class="box"><a href="imagery.html">Imagery commands manual</a></li>
       </ul></td>
     </tr>
     <tr>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3> Vector processing</h3>
+      <td width="33%" valign="top" class="box"><h3> Vector processing</h3>
        <ul>
         <li class="box"><a href="vectorintro.html">Intro: vector map processing and network analysis</a></li>
         <li class="box"><a href="vector.html">Vector commands manual</a></li>
         <li class="box"><a href="vectorascii.html">GRASS ASCII vector format specification</a></li>
       </ul></td>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3> Database</h3>
+      <td width="33%" valign="top" class="box"><h3> Database</h3>
        <ul>
 	<li class="box"><a href="databaseintro.html">Intro: database management</a></li>
 	<li class="box"><a href="sql.html">SQL support in GRASS GIS</a></li>
 	<li class="box"><a href="database.html">Database commands manual</a></li>
        </ul>
       </td>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3> Temporal processing</h3>
+      <td width="33%" valign="top" class="box"><h3> Temporal processing</h3>
        <ul>
         <li class="box"><a href="temporalintro.html">Intro: temporal data processing</a></li>
         <li class="box"><a href="temporal.html">Temporal commands manual</a></li>
@@ -157,21 +161,21 @@
       </td>
     </tr>
     <tr>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3> Cartography</h3>
+      <td width="33%" valign="top" class="box"><h3> Cartography</h3>
        <ul>
         <li class="box"><a href="postscript.html">Postscript commands manual</a></li>
         <li class="box"><a href="g.gui.psmap.html">wxGUI Cartographic Composer</a></li>
        </ul>
       </td>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3> Miscellaneous & Variables</h3>
+      <td width="33%" valign="top" class="box"><h3> Miscellaneous & Variables</h3>
        <ul>
         <li class="box"><a href="misc.html">Miscellaneous commands manual</a></li>
         <li class="box"><a href="variables.html">GRASS variables and environment variables</a></li>
        </ul>
       </td>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3> GRASS GIS Wiki</h3>
+      <td width="33%" valign="top" class="box"><h3> Python</h3>
        <ul>
-        <li class="box"><a href="http://grasswiki.osgeo.org/wiki/Faq">FAQ - Frequently Asked Questions</a></li>
+        <li class="box"><a href="http://grass.osgeo.org/grass${grass_version_major}${grass_version_minor}/manuals/libpython/pygrass_index.html">PyGRASS documentation</a></li>
        </ul>
       </td>
     </tr>
@@ -184,6 +188,8 @@
 r"""<hr class="header">
 <p><a href="${index_url}">Help 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>
 <p>© 2003-${year} <a href="http://grass.osgeo.org">GRASS Development Team</a>, GRASS GIS ${grass_version} Reference Manual</p>
+
+</div>
 </body>
 </html>
 """)
@@ -204,6 +210,7 @@
 toc = \
 r"""
 <div class="toc">
+<h4 class="toc">Table of contents</h4>
 <ul class="toc">
 <li class="toc"><a class="toc" href="full_index.html#d">Display commands (d.*)</a></li>
 <li class="toc"><a class="toc" href="full_index.html#db">Database commands (db.*)</a></li>
@@ -266,6 +273,7 @@
 <link rel="stylesheet" href="grassdocs.css" type="text/css">
 </head>
 <body style="width: 99%">
+<div id="container">
 
 <a href="index.html"><img src="grass_logo.png" alt="GRASS logo"></a>
 <hr class="header">
@@ -279,6 +287,7 @@
 <link rel="stylesheet" href="grassdocs.css" type="text/css">
 </head>
 <body style="width: 99%">
+<div id="container">
 
 <a href="index.html"><img src="grass_logo.png" alt="GRASS logo"></a>
 <hr class="header">
@@ -291,6 +300,7 @@
 <link rel="stylesheet" href="grassdocs.css" type="text/css">
 </head>
 <body bgcolor="white">
+<div id="container">
 
 <a href="index.html"><img src="grass_logo.png" alt="GRASS logo"></a>
 <hr class="header">
@@ -354,8 +364,8 @@
     f.write(header2_tmpl.substitute(grass_version = grass_version, body_width = body_width))
 
 def write_html_cmd_overview(f):
-    box_color = "#e1ecd0"
-    f.write(overview_tmpl.substitute(box_color = box_color))
+    f.write(overview_tmpl.substitute(grass_version_major = grass_version_major,
+                                     grass_version_minor = grass_version_minor))
 
 def write_html_footer(f, index_url, year = None):
     if year is None:
@@ -395,6 +405,8 @@
 html_dir = os.path.join(arch_dist_dir, "docs", "html")
 gisbase = os.environ['GISBASE']
 grass_version = os.getenv("VERSION_NUMBER", "unknown")
+grass_version_major = grass_version.split('.')[0]
+grass_version_minor = grass_version.split('.')[1]
 grass_mmver = '.'.join(grass_version.split('.')[0:2])
 macosx = "darwin" in os.environ['ARCH'].lower()
 default_year = os.getenv("VERSION_DATE")

Modified: grass/branches/releasebranch_7_0/man/grassdocs.css
===================================================================
--- grass/branches/releasebranch_7_0/man/grassdocs.css	2014-11-17 23:28:57 UTC (rev 62781)
+++ grass/branches/releasebranch_7_0/man/grassdocs.css	2014-11-17 23:40:40 UTC (rev 62782)
@@ -1,4 +1,4 @@
-/* GRASS documentation site style sheet
+/* GRASS GIS documentation site style sheet
  *
  * send improvements to GRASS Developers list
  * 
@@ -14,9 +14,31 @@
     background: white;
     color: black;
     font-family: arial,sans-serif;
-    width: 80%;
 }
 
+#container
+{
+    position: relative;
+    margin: 0 auto;
+    padding-left:  10px;
+    padding-right: 10px;
+/*    width: 750px; */
+    width: 70%;
+    background-color: white;
+    height:auto !important;
+    min-height: 100%;
+    border-style:solid;
+    border-bottom-width: 2px;
+    border-top-width: 2px;
+    border-left-width: 10px;
+    border-right-width: 10px;
+    border-color: #DDDDDD;
+}
+
+img {
+    max-width: 100%;
+}
+
 hr.header {
     height: 3px;
     color: gray;
@@ -29,7 +51,8 @@
     color: rgb(25%, 60%, 25%);
     font-family: arial,sans-serif;
     font-weight: bold;
-    font-size: x-large;
+    font-size: xx-large;
+    width: 80%; /* avoid collision with toc */
 }
 
 h2{
@@ -37,7 +60,7 @@
     color: rgb(25%, 60%, 25%);
     font-family: arial,sans-serif;
     font-weight: bold;
-    font-size: large;
+    font-size: x-large;
 }
 
 h3{
@@ -56,6 +79,14 @@
     font-size: medium;
 }
 
+a {
+    color: rgb(25%, 60%, 25%);
+}
+
+a:visited {
+    color: rgb(25%, 60%, 25%);
+}
+
 a.urlblack {
     color: black;
 }
@@ -81,13 +112,14 @@
 }
 
 td.box {
-    border:  1px solid #c9c9c9;
+    border:  2px solid rgb(25%, 60%, 25%);
     border-radius: 10px;
     margin: 0px 2px 2px 10px;
     padding: 4px 4px 4px 4px;
 }
 
 li.box {
+    margin-left: -20px;
     color: rgb(25%, 60%, 25%);
 }
 
@@ -108,7 +140,7 @@
 }
 
 div.toc{
-    background-color: transparent;
+    /* background-color: transparent; */
     position: fixed;
     border: solid 1px rgb(25%, 60%, 25%);
     top: 5px;
@@ -116,19 +148,53 @@
     width: 17%;
     font-size: small;
     border-radius: 10px;
+    z-index: 1;
 }
 
 li.toc {
-   margin-left: -15px;
-   padding: 3px 3px; 3px; 3px;
+   margin-left: 0;
+   padding: 3px 3px 3px 3px;
+   padding-left: 0;
    color: rgb(25%, 60%, 25%);
 }
 
 ul.toc {
    margin-top: 3px;
    margin-bottom: 3px;
+   padding-left: 10%;
+   margin-left: 5%;
 }
 
 a.toc {
     text-decoration: none;
 }
+
+a.toc:hover, a.toc:active {
+    text-decoration: underline;
+}
+
+h4.toc {
+    padding-top: 3px;
+    margin-top: 3px;
+    padding-bottom: 3px;
+    margin-bottom: 3px;
+    padding-left: 6px;
+}
+
+/* show and hide toc */
+
+div.toc:hover ul {
+  display: block;
+}
+
+div.toc ul {
+  display: none;
+}
+
+div.toc:hover {
+  background-color: white;
+}
+
+div.toc {
+  background-color: rgba(255, 255, 255, 0.7);
+}

Modified: grass/branches/releasebranch_7_0/tools/mkhtml.py
===================================================================
--- grass/branches/releasebranch_7_0/tools/mkhtml.py	2014-11-17 23:28:57 UTC (rev 62781)
+++ grass/branches/releasebranch_7_0/tools/mkhtml.py	2014-11-17 23:40:40 UTC (rev 62782)
@@ -36,6 +36,8 @@
 <link rel="stylesheet" href="grassdocs.css" type="text/css">
 </head>
 <body bgcolor="white">
+<div id="container">
+
 <a href="index.html"><img src="grass_logo.png" alt="GRASS logo"></a>
 <hr class="header">
 """
@@ -47,10 +49,15 @@
 <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>
 <p>© 2003-${YEAR} <a href="http://grass.osgeo.org">GRASS Development Team</a>, GRASS GIS ${GRASS_VERSION} Reference Manual</p>
+</div>
 </body>
 </html>
 """)
@@ -59,6 +66,7 @@
 """<hr class="header">
 <p><a href="index.html">Main 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>
 <p>© 2003-${YEAR} <a href="http://grass.osgeo.org">GRASS Development Team</a>, GRASS GIS ${GRASS_VERSION} Reference Manual</p>
+</div>
 </body>
 </html>
 """)
@@ -133,6 +141,7 @@
     
     fd = sys.stdout
     fd.write('<div class="toc">\n')
+    fd.write('<h4 class="toc">Table of contents</h4>\n')
     fd.write('<ul class="toc">\n')
     first = True
     has_h2 = False
@@ -176,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