[GRASS-SVN] r62762 - in grass/trunk: lib/gis man
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Nov 17 00:48:05 PST 2014
Author: lucadelu
Date: 2014-11-17 00:48:04 -0800 (Mon, 17 Nov 2014)
New Revision: 62762
Modified:
grass/trunk/lib/gis/parser_html.c
grass/trunk/man/build_keywords.py
grass/trunk/man/build_topics.py
grass/trunk/man/grassdocs.css
Log:
manual: cliccable topics refs, anchors for keyword page, pep8 cleanup
Modified: grass/trunk/lib/gis/parser_html.c
===================================================================
--- grass/trunk/lib/gis/parser_html.c 2014-11-17 08:00:54 UTC (rev 62761)
+++ grass/trunk/lib/gis/parser_html.c 2014-11-17 08:48:04 UTC (rev 62762)
@@ -326,7 +326,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) {
@@ -344,10 +343,7 @@
fprintf(f, ".html\">%s</a>", str);
}
else {
-#endif
fprintf(f, "%s", str);
-#if 0
}
-#endif
}
#undef do_escape
Modified: grass/trunk/man/build_keywords.py
===================================================================
--- grass/trunk/man/build_keywords.py 2014-11-17 08:00:54 UTC (rev 62761)
+++ grass/trunk/man/build_keywords.py 2014-11-17 08:48:04 UTC (rev 62762)
@@ -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/trunk/man/build_topics.py
===================================================================
--- grass/trunk/man/build_topics.py 2014-11-17 08:00:54 UTC (rev 62761)
+++ grass/trunk/man/build_topics.py 2014-11-17 08:48:04 UTC (rev 62762)
@@ -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/trunk/man/grassdocs.css
===================================================================
--- grass/trunk/man/grassdocs.css 2014-11-17 08:00:54 UTC (rev 62761)
+++ grass/trunk/man/grassdocs.css 2014-11-17 08:48:04 UTC (rev 62762)
@@ -87,6 +87,10 @@
color: rgb(25%, 60%, 25%);
}
+a.urlblack {
+ color: black;
+}
+
div.code{
width: 97%;
color : black;
More information about the grass-commit
mailing list