From 29cef0bd5301252b28c33da292d90441354700f8 Mon Sep 17 00:00:00 2001 From: underscorediscovery Date: Tue, 5 Feb 2019 18:14:34 -0800 Subject: [PATCH] docs; update generator - copies files in doc/site/static/ to output - update output formatting to include potential differences in markdown generator (local generate had &gt;, so cover both to remain consistent) - copy rss xml (could be in static too, but for now...) --- util/generate_docs.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/util/generate_docs.py b/util/generate_docs.py index 1c98c978..a43d83ae 100755 --- a/util/generate_docs.py +++ b/util/generate_docs.py @@ -130,6 +130,7 @@ def format_file(path, skip_up_to_date): # Use special formatting for example output and errors. html = html.replace('//> ', '') + html = html.replace('//&gt; ', '') html = html.replace('//! ', '') modified = datetime.fromtimestamp(os.path.getmtime(in_path)) @@ -167,6 +168,24 @@ def check_sass(): print("Built build/docs/style.css") +def copy_static(): + shutil.copy2("doc/site/blog/rss.xml", "build/docs/blog/rss.xml") + + for root, dirnames, filenames in os.walk('doc/site/static'): + for filename in filenames: + source = os.path.join(root, filename) + source_mod = os.path.getmtime(source) + dest = os.path.join("build/docs", filename) + dest_mod = 0 + if os.path.exists(dest): + dest_mod = os.path.getmtime('build/docs/style.css') + + if source_mod < dest_mod: + return + + shutil.copy2(source, dest) + print('Copied ' + filename) + def format_files(skip_up_to_date): check_sass() @@ -175,6 +194,7 @@ def format_files(skip_up_to_date): f = os.path.relpath(os.path.join(root, filename), 'doc/site') format_file(f, skip_up_to_date) + copy_static() def run_server(): port = 8000