Browse Source

mkhtml: enable path setting for footer html pages (topics.html...) on add-on manual page (#1122)

(required to compile add-ons to properly create server-side html man pages)
Tomas Zigo 4 years ago
parent
commit
3f51ea729f
1 changed files with 28 additions and 15 deletions
  1. 28 15
      tools/mkhtml.py

+ 28 - 15
tools/mkhtml.py

@@ -110,11 +110,11 @@ footer_index = string.Template(
 """<hr class="header">
 <p>
 <a href="index.html">Main index</a> |
-<a href="${INDEXNAME}.html">${INDEXNAMECAP} index</a> |
-<a href="topics.html">Topics index</a> |
-<a href="keywords.html">Keywords index</a> |
-<a href="graphical_index.html">Graphical index</a> |
-<a href="full_index.html">Full index</a>
+<a href="${HTML_PAGE_FOOTER_PAGES_PATH}${INDEXNAME}.html">${INDEXNAMECAP} index</a> |
+<a href="${HTML_PAGE_FOOTER_PAGES_PATH}topics.html">Topics index</a> |
+<a href="${HTML_PAGE_FOOTER_PAGES_PATH}keywords.html">Keywords index</a> |
+<a href="${HTML_PAGE_FOOTER_PAGES_PATH}graphical_index.html">Graphical index</a> |
+<a href="${HTML_PAGE_FOOTER_PAGES_PATH}full_index.html">Full index</a>
 </p>
 <p>
 &copy; 2003-${YEAR}
@@ -131,10 +131,10 @@ footer_noindex = string.Template(
 """<hr class="header">
 <p>
 <a href="index.html">Main index</a> |
-<a href="topics.html">Topics index</a> |
-<a href="keywords.html">Keywords index</a> |
-<a href="graphical_index.html">Graphical index</a> |
-<a href="full_index.html">Full index</a>
+<a href="${HTML_PAGE_FOOTER_PAGES_PATH}topics.html">Topics index</a> |
+<a href="${HTML_PAGE_FOOTER_PAGES_PATH}keywords.html">Keywords index</a> |
+<a href="${HTML_PAGE_FOOTER_PAGES_PATH}graphical_index.html">Graphical index</a> |
+<a href="${HTML_PAGE_FOOTER_PAGES_PATH}full_index.html">Full index</a>
 </p>
 <p>
 &copy; 2003-${YEAR}
@@ -404,6 +404,9 @@ else:
 if sys.platform == 'win32':
     url_source = url_source.replace(os.path.sep, '/')
 
+html_page_footer_pages_path = os.getenv('HTML_PAGE_FOOTER_PAGES_PATH') if \
+    os.getenv('HTML_PAGE_FOOTER_PAGES_PATH') else ''
+
 if index_name:
     tree = 'grass/tree'
     commits = 'grass/commits'
@@ -419,10 +422,20 @@ if index_name:
     sys.stdout.write(sourcecode.substitute(
         URL_SOURCE=url_source, PGM=pgm, URL_LOG=url_source.replace(
             tree,  commits)))
-    sys.stdout.write(footer_index.substitute(INDEXNAME=index_name,
-                                             INDEXNAMECAP=index_name_cap,
-                                             YEAR=year,
-                                             GRASS_VERSION=grass_version))
+    sys.stdout.write(
+        footer_index.substitute(
+            INDEXNAME=index_name,
+            INDEXNAMECAP=index_name_cap,
+            YEAR=year,
+            GRASS_VERSION=grass_version,
+            HTML_PAGE_FOOTER_PAGES_PATH=html_page_footer_pages_path,
+        ),
+    )
 else:
-    sys.stdout.write(footer_noindex.substitute(YEAR=year,
-                                               GRASS_VERSION=grass_version))
+    sys.stdout.write(
+        footer_noindex.substitute(
+            YEAR=year,
+            GRASS_VERSION=grass_version,
+            HTML_PAGE_FOOTER_PAGES_PATH=html_page_footer_pages_path,
+        ),
+    )