瀏覽代碼

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 年之前
父節點
當前提交
3c08fea1d6
共有 2 個文件被更改,包括 8 次插入3 次删除
  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)
 endef
 
-$(HTMLDIR)/topics.html: $(ALL_HTML)
+$(HTMLDIR)/topics.html: $(ALL_HTML) build_topics.py
 	$(call build_topics)
 	touch $@
 

+ 7 - 2
man/build_topics.py

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