Forráskód Böngészése

doc: new style for manual pages (backport of trunk https://trac.osgeo.org/grass/changeset/61935 and subsequent updates)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@62782 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 10 éve
szülő
commit
cfe45fd885
5 módosított fájl, 136 hozzáadás és 33 törlés
  1. 2 1
      lib/gis/parser_html.c
  2. 8 0
      man/Makefile
  3. 34 22
      man/build_html.py
  4. 74 8
      man/grassdocs.css
  5. 18 2
      tools/mkhtml.py

+ 2 - 1
lib/gis/parser_html.c

@@ -49,7 +49,8 @@ void G__usage_html(void)
     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");

+ 8 - 0
man/Makefile

@@ -29,6 +29,13 @@ INDICES := $(patsubst %,$(HTMLDIR)/%.html,$(IDXSRC))
 
 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_logo.png: grass_logo.png
 
 $(HTMLDIR)/grass_icon.png: grass_icon.png
 	$(INSTALL_DATA) $< $@
+

+ 34 - 22
man/build_html.py

@@ -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 @@ header2_tmpl = string.Template(\
 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 @@ processing and geographic information system (GIS).</p>
 #"
 
 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>&nbsp;Quick Introduction</h3>
+      <td width="33%" valign="top" class="box"><h3>&nbsp;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>&nbsp;Display/Graphical User Interfaces</h3>
+      <td width="33%" valign="top" class="box"><h3>&nbsp;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 @@ r"""<!-- the files grass7.html & helptext.html file live in lib/init/ -->
        <ul>
         <li class="box"><a href="topic_gui.html">GUI commands</a></li>
        </ul>
-
+       <h3>&nbsp;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>&nbsp;General</h3>
+      <td width="33%" valign="top" class="box"><h3>&nbsp;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>&nbsp;Addons</h3>
@@ -118,38 +122,38 @@ r"""<!-- the files grass7.html & helptext.html file live in lib/init/ -->
       </td>
     </tr>
     <tr>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3>&nbsp;Raster processing</h3>
+      <td width="33%" valign="top" class="box"><h3>&nbsp;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>&nbsp;3D raster processing</h3>
+      <td width="33%" valign="top" class="box"><h3>&nbsp;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>&nbsp;Image processing</h3>
+      <td width="33%" valign="top" class="box"><h3>&nbsp;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>&nbsp;Vector processing</h3>
+      <td width="33%" valign="top" class="box"><h3>&nbsp;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>&nbsp;Database</h3>
+      <td width="33%" valign="top" class="box"><h3>&nbsp;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>&nbsp;Temporal processing</h3>
+      <td width="33%" valign="top" class="box"><h3>&nbsp;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 @@ r"""<!-- the files grass7.html & helptext.html file live in lib/init/ -->
       </td>
     </tr>
     <tr>
-      <td width="33%" valign="top" bgcolor="${box_color}" class="box"><h3>&nbsp;Cartography</h3>
+      <td width="33%" valign="top" class="box"><h3>&nbsp;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>&nbsp;Miscellaneous&nbsp;&amp;&nbsp;Variables</h3>
+      <td width="33%" valign="top" class="box"><h3>&nbsp;Miscellaneous&nbsp;&amp;&nbsp;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>&nbsp;GRASS GIS Wiki</h3>
+      <td width="33%" valign="top" class="box"><h3>&nbsp;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 @@ footer_tmpl = string.Template(\
 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>&copy; 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 @@ r"""<tr><td valign="top"><a href="${cmd}">${basename}</a></td> <td>${desc}</td><
 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 @@ r"""
 <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 @@ r"""
 <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 @@ r"""
 <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 @@ def write_html_header(f, title, ismain = False, body_width = "99%"):
     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 @@ arch_dist_dir = os.environ['ARCH_DISTDIR']
 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")

+ 74 - 8
man/grassdocs.css

@@ -1,4 +1,4 @@
-/* GRASS documentation site style sheet
+/* GRASS GIS documentation site style sheet
  *
  * send improvements to GRASS Developers list
  * 
@@ -14,7 +14,29 @@ body{
     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 {
@@ -29,7 +51,8 @@ h1{
     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 @@ h2{
     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 @@ h4{
     font-size: medium;
 }
 
+a {
+    color: rgb(25%, 60%, 25%);
+}
+
+a:visited {
+    color: rgb(25%, 60%, 25%);
+}
+
 a.urlblack {
     color: black;
 }
@@ -81,13 +112,14 @@ span.code {
 }
 
 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 @@ td {
 }
 
 div.toc{
-    background-color: transparent;
+    /* background-color: transparent; */
     position: fixed;
     border: solid 1px rgb(25%, 60%, 25%);
     top: 5px;
@@ -116,19 +148,53 @@ div.toc{
     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);
+}

+ 18 - 2
tools/mkhtml.py

@@ -36,6 +36,8 @@ header_base = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <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 @@ header_pgm = """<h2>NAME</h2>
 <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>&copy; 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 @@ footer_noindex = string.Template(\
 """<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>&copy; 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 @@ def write_toc(data):
     
     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 @@ def update_toc(data):
 # 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):