From: Jonathan S. Katz Date: Mon, 1 Apr 2019 01:40:03 +0000 (-0400) Subject: Add Bootstrap grid classes to images referenced in the HTML docs. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=b8038754aa291d6957d83285d96cdf1cf3489656;p=pgweb.git Add Bootstrap grid classes to images referenced in the HTML docs. --- diff --git a/tools/docs/docload.py b/tools/docs/docload.py index 1f363c80..094d9651 100755 --- a/tools/docs/docload.py +++ b/tools/docs/docload.py @@ -14,6 +14,8 @@ from configparser import ConfigParser import psycopg2 +# the Bootstrap grid classes that are added onto any images that are rendered in the docs +BOOTSTRAP_FIGURE_CLASS = r'([^<]+)', re.IGNORECASE) +# regular expression used to find any images that are in the HTML and apply +# additional bootstrap classes +re_figure_match = re.compile(']+)class="figure"', re.IGNORECASE) # Load a single page @@ -67,6 +72,10 @@ def load_doc_file(filename, f, c): else: title = "" + # find any images that are embedded in the HTML and add in the Bootstrap grid classes + # in order to ensure they are able to display responsively + contents = re_figure_match.sub(BOOTSTRAP_FIGURE_CLASS, contents) + # if not in quiet mode, output the (filename, title) pair of the docpage that is being processed if not quiet: print("--- file: %s (%s) ---" % (filename, title))