#!/usr/bin/env python3 ############################################################################ # # MODULE: build_graphical_index # AUTHOR(S): Vaclav Petras # PURPOSE: Build graphical index # COPYRIGHT: (C) 2015-2022 by Vaclav Petras and the GRASS Development Team # # This program is free software under the GNU General Public # License (>=v2). Read the file COPYING that comes with GRASS # for details. # ############################################################################# import os import sys from build_html import write_html_footer, grass_version, header1_tmpl output_name = "graphical_index.html" year = os.getenv("VERSION_DATE") # other similar strings are in a different file # TODO: all HTML manual building needs refactoring (perhaps grass.tools?) header_graphical_index_tmpl = """\
GRASS logo

Graphical index of GRASS GIS modules

""" def std_img_name(name): return "gi_{0}.jpg".format(name) index_items = [ ("raster_graphical.html", std_img_name("raster"), "Raster"), ("vector_graphical.html", std_img_name("vector"), "Vector"), ("database_graphical.html", std_img_name("database"), "Database"), ("general_graphical.html", std_img_name("general"), "General"), ("display_graphical.html", std_img_name("display"), "Display"), ("imagery_graphical.html", std_img_name("imagery"), "Imagery"), ("raster3d_graphical.html", std_img_name("raster3d"), "3D raster"), ("temporal_graphical.html", std_img_name("temporal"), "Temporal"), ("miscellaneous_graphical.html", std_img_name("miscellaneous"), "Miscellaneous"), ("postscript_graphical.html", std_img_name("cartography"), "Cartography"), ("wxGUI_graphical.html", std_img_name("gui"), "GUI"), ("wxGUI.nviz.html", std_img_name("3dview"), "3D view"), ( "https://grass.osgeo.org/grass-devel/manuals/libpython/index.html", std_img_name("python"), "Python", ), ("https://grass.osgeo.org/programming8/", std_img_name("c"), "C library"), ("manual_gallery.html", std_img_name("gallery"), "Gallery"), ( "https://grass.osgeo.org/grass8/manuals/addons/", std_img_name("addons"), "Addons", ), ] def main(): html_dir = sys.argv[1] with open(os.path.join(html_dir, output_name), "w") as output: output.write( header1_tmpl.substitute( title="GRASS GIS %s Reference " "Manual: Graphical index" % grass_version ) ) output.write(header_graphical_index_tmpl) output.write('") write_html_footer(output, "index.html", year) if __name__ == "__main__": main()