Bladeren bron

docs: do not add small topics to index

Topics with less than 3 modules in them are not included in Topics index. This makes the index shorter and easier to navigate. Topics are still included in keyword index as keywords, so there is no need to list them when they are not so important (assuming importance/impact equals module count).

The topic pages are still generated, so there is no need to change anything for the modules. By clicking at the second keyword users still gets to the topic page. It is just not advertised in the Topics index.


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@66040 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 9 jaren geleden
bovenliggende
commit
3c08fea1d6
2 gewijzigde bestanden met toevoegingen van 8 en 3 verwijderingen
  1. 1 1
      man/Makefile
  2. 7 2
      man/build_topics.py

+ 1 - 1
man/Makefile

@@ -79,7 +79,7 @@ GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
 	$(PYTHON) ./build_class_graphical.py $(HTMLDIR)
 	$(PYTHON) ./build_class_graphical.py $(HTMLDIR)
 endef
 endef
 
 
-$(HTMLDIR)/topics.html: $(ALL_HTML)
+$(HTMLDIR)/topics.html: $(ALL_HTML) build_topics.py
 	$(call build_topics)
 	$(call build_topics)
 	touch $@
 	touch $@
 
 

+ 7 - 2
man/build_topics.py

@@ -12,6 +12,8 @@ from build_html import *
 path = sys.argv[1]
 path = sys.argv[1]
 year = os.getenv("VERSION_DATE")
 year = os.getenv("VERSION_DATE")
 
 
+min_num_modules_for_topic = 3
+
 keywords = {}
 keywords = {}
 
 
 htmlfiles = glob.glob1(path, '*.html')
 htmlfiles = glob.glob1(path, '*.html')
@@ -46,16 +48,19 @@ topicsfile.write(header1_tmpl.substitute(title = "GRASS GIS " \
 topicsfile.write(headertopics_tmpl)
 topicsfile.write(headertopics_tmpl)
 
 
 for key, values in sorted(keywords.iteritems()):
 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')
     keyfile = open(os.path.join(path, 'topic_%s.html' % key.lower()), 'w')
     keyfile.write(header1_tmpl.substitute(title = "GRASS GIS " \
     keyfile.write(header1_tmpl.substitute(title = "GRASS GIS " \
                         "%s Reference Manual: Topic %s" % (grass_version,
                         "%s Reference Manual: Topic %s" % (grass_version,
                                                     key.replace('_', ' '))))
                                                     key.replace('_', ' '))))
     keyfile.write(headerkey_tmpl.substitute(keyword=key.replace('_', ' ')))
     keyfile.write(headerkey_tmpl.substitute(keyword=key.replace('_', ' ')))
+    num_modules = 0
     for mod, desc in sorted(values.iteritems()):
     for mod, desc in sorted(values.iteritems()):
+        num_modules += 1
         keyfile.write(desc1_tmpl.substitute(cmd=mod, desc=desc,
         keyfile.write(desc1_tmpl.substitute(cmd=mod, desc=desc,
                                             basename=mod.replace('.html', '')))
                                             basename=mod.replace('.html', '')))
+    if num_modules >= min_num_modules_for_topic:
+        topicsfile.writelines([moduletopics_tmpl.substitute(
+            key=key.lower(), name=key.replace('_', ' '))])
     keyfile.write("</table>\n")
     keyfile.write("</table>\n")
     write_html_footer(keyfile, "index.html", year)
     write_html_footer(keyfile, "index.html", year)
 topicsfile.write("</ul>\n")
 topicsfile.write("</ul>\n")