[GRASS-SVN] r62768 - in grass/branches/releasebranch_7_0: . lib/gis man

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 17 03:33:43 PST 2014


Author: neteler
Date: 2014-11-17 03:33:43 -0800 (Mon, 17 Nov 2014)
New Revision: 62768

Modified:
   grass/branches/releasebranch_7_0/
   grass/branches/releasebranch_7_0/lib/gis/parser_html.c
   grass/branches/releasebranch_7_0/man/build_keywords.py
   grass/branches/releasebranch_7_0/man/build_topics.py
   grass/branches/releasebranch_7_0/man/grassdocs.css
Log:
manual: cliccable topics refs, anchors for keyword page, pep8 cleanup (trunk, r62762)


Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
   - /grass/trunk:60817,61096,61141,62179-62180,62182,62403,62422,62424,62437,62466,62469,62487,62491,62494,62501,62506,62508-62509,62515,62518-62519,62521,62526,62533,62539,62541,62555,62562,62570,62573,62575,62585,62588,62597,62603,62606,62608-62609,62614,62618,62628,62632,62638,62642,62648-62649,62652,62654-62657,62666,62723,62730,62739,62741,62743,62746,62750,62752,62757
   + /grass/trunk:60817,61096,61141,62179-62180,62182,62403,62422,62424,62437,62466,62469,62487,62491,62494,62501,62506,62508-62509,62515,62518-62519,62521,62526,62533,62539,62541,62555,62562,62570,62573,62575,62585,62588,62597,62603,62606,62608-62609,62614,62618,62628,62632,62638,62642,62648-62649,62652,62654-62657,62666,62723,62730,62739,62741,62743,62746,62750,62752,62757,62762

Modified: grass/branches/releasebranch_7_0/lib/gis/parser_html.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/gis/parser_html.c	2014-11-17 11:30:21 UTC (rev 62767)
+++ grass/branches/releasebranch_7_0/lib/gis/parser_html.c	2014-11-17 11:33:43 UTC (rev 62768)
@@ -321,7 +321,6 @@
 
 void print_escaped_for_html_keywords(FILE * f, const char * str)
 {
-#if 0 /* temporary disabled */
     /* HTML link only for second keyword */
     if (st->n_keys > 1 &&
         strcmp(st->module_info.keywords[1], str) == 0) {
@@ -339,10 +338,7 @@
         fprintf(f, ".html\">%s</a>", str);
     }
     else {
-#endif
         fprintf(f, "%s", str);
-#if 0
     }
-#endif
 }
 #undef do_escape

Modified: grass/branches/releasebranch_7_0/man/build_keywords.py
===================================================================
--- grass/branches/releasebranch_7_0/man/build_keywords.py	2014-11-17 11:30:21 UTC (rev 62767)
+++ grass/branches/releasebranch_7_0/man/build_keywords.py	2014-11-17 11:33:43 UTC (rev 62768)
@@ -7,7 +7,6 @@
 import os
 import sys
 import glob
-import string
 from build_html import *
 
 blacklist = ['Display', 'Database', 'General', 'Imagery', 'Misc', 'Postscript',
@@ -37,6 +36,10 @@
         continue
     for key in keys:
         key = key.strip()
+        try:
+            key = key.split('>')[1].split('<')[0]
+        except:
+            pass
         key = "%s%s" % (key[0].upper(), key[1:])
         if key not in keywords.keys():
             keywords[key] = []
@@ -56,7 +59,7 @@
 keywordsfile.write(headerkeywords_tmpl)
 keywordsfile.write('<dl>')
 for key, values in sorted(keywords.iteritems()):
-    keyword_line = "<dt><b>%s</b></dt><dd>" % key
+    keyword_line = '<dt><b><a name="%s" class="urlblack">%s</a></b></dt><dd>' % (key, key)
     for value in sorted(values):
         keyword_line += ' <a href="%s">%s</a>,' % (value, value.replace('.html',
                                                                         ''))

Modified: grass/branches/releasebranch_7_0/man/build_topics.py
===================================================================
--- grass/branches/releasebranch_7_0/man/build_topics.py	2014-11-17 11:30:21 UTC (rev 62767)
+++ grass/branches/releasebranch_7_0/man/build_topics.py	2014-11-17 11:33:43 UTC (rev 62768)
@@ -7,7 +7,6 @@
 import os
 import sys
 import glob
-import string
 from build_html import *
 
 path = sys.argv[1]
@@ -15,23 +14,24 @@
 
 keywords = {}
 
-htmlfiles = glob.glob1(path,'*.html')
+htmlfiles = glob.glob1(path, '*.html')
 
 for fname in htmlfiles:
-    fil = open(os.path.join(path,fname))
+    fil = open(os.path.join(path, fname))
     # TODO maybe move to Python re (regex)
-    lines=fil.readlines()
+    lines = fil.readlines()
     try:
         index_keys = lines.index('<h2>KEYWORDS</h2>\n')+1
         index_desc = lines.index('<h2>NAME</h2>\n')+1
     except:
-        continue 
+        continue
     try:
         key = lines[index_keys].split(',')[1].strip().capitalize().replace(' ', '_')
+        key = key.split('>')[1].split('<')[0]
     except:
         continue
     try:
-        desc = lines[index_desc].split('-',1)[1].strip()
+        desc = lines[index_desc].split('-', 1)[1].strip()
     except:
         desc.strip()
     if key not in keywords.keys():
@@ -40,23 +40,24 @@
     elif fname not in keywords[key]:
         keywords[key][fname] = desc
 
-topicsfile = open(os.path.join(path,'topics.html'),'w')
+topicsfile = open(os.path.join(path, 'topics.html'), 'w')
 topicsfile.write(header1_tmpl.substitute(title = "GRASS GIS " \
                         "%s Reference Manual: Topics index" % grass_version))
 topicsfile.write(headertopics_tmpl)
+
 for key, values in sorted(keywords.iteritems()):
-    topicsfile.writelines([moduletopics_tmpl.substitute(key = key.lower(), 
-                                                        name = key.replace('_', ' '))])
-    keyfile = open(os.path.join(path,'topic_%s.html' % key.lower()),'w')
+    topicsfile.writelines([moduletopics_tmpl.substitute(key=key.lower(),
+                                                        name=key.replace('_', ' '))])
+    keyfile = open(os.path.join(path, 'topic_%s.html' % key.lower()), 'w')
     keyfile.write(header1_tmpl.substitute(title = "GRASS GIS " \
-                        "%s Reference Manual: Topic %s" % (grass_version, 
+                        "%s Reference Manual: Topic %s" % (grass_version,
                                                     key.replace('_', ' '))))
-    keyfile.write(headerkey_tmpl.substitute(keyword = key.replace('_', ' ')))
+    keyfile.write(headerkey_tmpl.substitute(keyword=key.replace('_', ' ')))
     for mod, desc in sorted(values.iteritems()):
-        keyfile.write(desc1_tmpl.substitute(cmd = mod, desc = desc, 
-                                            basename = mod.replace('.html','')))
+        keyfile.write(desc1_tmpl.substitute(cmd=mod, desc=desc,
+                                            basename=mod.replace('.html', '')))
     keyfile.write("</table>\n")
     write_html_footer(keyfile, "index.html", year)
 topicsfile.write("</ul>\n")
-write_html_footer(topicsfile, "index.html", year)  
+write_html_footer(topicsfile, "index.html", year)
 topicsfile.close()

Modified: grass/branches/releasebranch_7_0/man/grassdocs.css
===================================================================
--- grass/branches/releasebranch_7_0/man/grassdocs.css	2014-11-17 11:30:21 UTC (rev 62767)
+++ grass/branches/releasebranch_7_0/man/grassdocs.css	2014-11-17 11:33:43 UTC (rev 62768)
@@ -56,6 +56,10 @@
     font-size: medium;
 }
 
+a.urlblack {
+    color: black;
+}
+
 div.code{
     width: 97%;
     color : black;



More information about the grass-commit mailing list