From c97dd03d61f142060824cec9ad12e299dfc45677 Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Wed, 26 May 2021 23:31:48 +0300 Subject: [PATCH] Store doc generation date once --- docs/ElunaDoc/__main__.py | 5 +++-- docs/ElunaDoc/templates/_base.html | 2 +- docs/ElunaDoc/templates/date.js | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 docs/ElunaDoc/templates/date.js diff --git a/docs/ElunaDoc/__main__.py b/docs/ElunaDoc/__main__.py index 2e33cc0..3748166 100644 --- a/docs/ElunaDoc/__main__.py +++ b/docs/ElunaDoc/__main__.py @@ -40,10 +40,9 @@ def make_renderer(template_path, link_parser_factory): template = env.get_template(template_name) static = make_static(level) root = make_root(level) - currdate = time.strftime("%d/%m/%Y") with open('build/' + output_path, 'w') as out: - out.write(template.render(level=level, static=static, root=root, currdate=currdate, **kwargs)) + out.write(template.render(level=level, static=static, root=root, **kwargs)) return inner @@ -152,6 +151,8 @@ if __name__ == '__main__': render('index.html', 'index.html', level=0, classes=classes) # Render the search index. render('search-index.js', 'search-index.js', level=0, classes=classes) + # Render the date. + render('date.js', 'date.js', level=0, currdate=time.strftime("%d/%m/%Y")) for class_ in classes: print 'Rending pages for class {}...'.format(class_.name) diff --git a/docs/ElunaDoc/templates/_base.html b/docs/ElunaDoc/templates/_base.html index 5c66f70..5b46ac9 100644 --- a/docs/ElunaDoc/templates/_base.html +++ b/docs/ElunaDoc/templates/_base.html @@ -99,7 +99,7 @@ -
Generated on {{ currdate }}
+
Generated on
©2016 - Eluna Lua Engine
diff --git a/docs/ElunaDoc/templates/date.js b/docs/ElunaDoc/templates/date.js new file mode 100644 index 0000000..d736d99 --- /dev/null +++ b/docs/ElunaDoc/templates/date.js @@ -0,0 +1 @@ +document.write("{{ currdate }}"); \ No newline at end of file