[GRASS-SVN] r62856 - in grass/trunk: lib/gis man

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Nov 22 04:11:07 PST 2014


Author: neteler
Date: 2014-11-22 04:11:07 -0800 (Sat, 22 Nov 2014)
New Revision: 62856

Modified:
   grass/trunk/lib/gis/parser_html.c
   grass/trunk/man/build_keywords.py
Log:
manual: keyword index HTML'ized

Modified: grass/trunk/lib/gis/parser_html.c
===================================================================
--- grass/trunk/lib/gis/parser_html.c	2014-11-22 12:08:49 UTC (rev 62855)
+++ grass/trunk/lib/gis/parser_html.c	2014-11-22 12:11:07 UTC (rev 62856)
@@ -323,12 +323,15 @@
 
 void print_escaped_for_html_keywords(FILE * f, const char * str)
 {
+    /* generate HTML links */
+
     /* HTML link only for second keyword */
     if (st->n_keys > 1 &&
         strcmp(st->module_info.keywords[1], str) == 0) {
     
         const char *s;
         
+        /* TODO: fprintf(f, _("topic: ")); */
         fprintf(f, "<a href=\"topic_");
         for (s = str; *s; s++) {
             switch (*s) {
@@ -339,8 +342,32 @@
         }
         fprintf(f, ".html\">%s</a>", str);
     }
-    else {
-        fprintf(f, "%s", str);
+    else { /* first and other than second keyword */
+         if (st->n_keys > 0 &&
+             strcmp(st->module_info.keywords[0], str) == 0) {
+             /* command family */
+             const char *s;
+
+             fprintf(f, "<a href=\"");
+             for (s = str; *s; s++) {
+                 switch (*s) {
+                     do_escape(' ', "_");
+                 default:
+                     fputc(*s, f);
+                 }
+             }
+             fprintf(f, ".html\">%s</a>", str);
+         } else {
+             /* keyword index */
+             if (st->n_keys > 0 &&
+                strcmp(st->module_info.keywords[2], str) == 0) {
+
+                /* TODO: fprintf(f, _("keywords: ")); */
+                fprintf(f, "<a href=\"keywords.html#%s\">%s</a>", str, str);
+             } else {
+                fprintf(f, "<a href=\"keywords.html#%s\">%s</a>", str, str);
+             }
+         }
     }
 }
 #undef do_escape

Modified: grass/trunk/man/build_keywords.py
===================================================================
--- grass/trunk/man/build_keywords.py	2014-11-22 12:08:49 UTC (rev 62855)
+++ grass/trunk/man/build_keywords.py	2014-11-22 12:11:07 UTC (rev 62856)
@@ -34,13 +34,14 @@
         keys = lines[index_keys].split(',')
     except:
         continue
+    print keys
     for key in keys:
         key = key.strip()
         try:
             key = key.split('>')[1].split('<')[0]
         except:
             pass
-        key = "%s%s" % (key[0].upper(), key[1:])
+        #key = "%s%s" % (key[0].upper(), key[1:])
         if key not in keywords.keys():
             keywords[key] = []
             keywords[key].append(fname)



More information about the grass-commit mailing list