瀏覽代碼

docs: do not add topics with less than 3 modules to the topics index in order to not clutter it (trunk, https://trac.osgeo.org/grass/changeset/66040)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@66109 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 9 年之前
父節點
當前提交
7384ab6542
共有 2 個文件被更改,包括 8 次插入3 次删除
  1. 1 1
      man/Makefile
  2. 7 2
      man/build_topics.py

+ 1 - 1
man/Makefile

@@ -67,7 +67,7 @@ GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
 	$(PYTHON) ./build_keywords.py $(HTMLDIR)
 	$(PYTHON) ./build_keywords.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")