⚡️ Precompile markdown & remove changelog

We already have Github's releases with all the changes, we don't need to
keep everything twice.

Instead of the changelog included in the about dialog there's now a link
to the release list, that should suffice.

Implements #3342
This commit is contained in:
Gina Häußge committed 2019-11-20 15:35:44 +01:00
1 parent d8c3063813
commit b7e0e89bb4
10 files changed
+49 -1303

No files matched your search

+5 -3
View File
@@ -1131,10 +1131,12 @@ class Server(object):
loaders = [app.jinja_loader, filesystem_loader]
if octoprint.util.is_running_from_source():
from markdown import markdown
root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../.."))
allowed = ["AUTHORS.md", "CHANGELOG.md", "SUPPORTERS.md", "THIRDPARTYLICENSES.md"]
files = {"_data/" + name: os.path.join(root, name) for name in allowed}
loaders.append(octoprint.util.jinja.SelectedFilesLoader(files))
allowed = ["AUTHORS.md", "SUPPORTERS.md", "THIRDPARTYLICENSES.md"]
files = {"_data/" + name + ".html": os.path.join(root, name) for name in allowed}
loaders.append(octoprint.util.jinja.SelectedFilesWithConversionLoader(files, conversion=markdown))
jinja_loader = jinja2.ChoiceLoader(loaders)
app.jinja_loader = jinja_loader
-1
View File
@@ -643,7 +643,6 @@ def fetch_template_data(refresh=False):
license=("OctoPrint License", dict(template="dialogs/about/license.jinja2", _div="about_license", custom_bindings=False)),
thirdparty=("Third Party Licenses", dict(template="dialogs/about/thirdparty.jinja2", _div="about_thirdparty", custom_bindings=False)),
authors=("Authors", dict(template="dialogs/about/authors.jinja2", _div="about_authors", custom_bindings=False)),
changelog=("Changelog", dict(template="dialogs/about/changelog.jinja2", _div="about_changelog", custom_bindings=False)),
supporters=("Supporters", dict(template="dialogs/about/supporters.jinja2", _div="about_sponsors", custom_bindings=False))
)
@@ -10,6 +10,7 @@
<li><i class="fa-li fa fa-question-circle"></i> FAQ: <a href="https://faq.octoprint.org" target="_blank" rel="noreferrer noopener">faq.octoprint.org</a></li>
<li><i class="fa-li fa fa-book"></i> Documentation: <a href="http://docs.octoprint.org" target="_blank" rel="noreferrer noopener">docs.octoprint.org</a></li>
<li><i class="fa-li fa fa-github"></i> Source Code: <a href="https://github.com/foosel/OctoPrint" target="_blank" rel="noreferrer noopener">github.com/foosel/OctoPrint</a></li>
<li><i class="fa-li fa fa-code-fork"></i> Changelog: <a href="https://github.com/foosel/OctoPrint/releases" target="_blank" rel="noreferrer noopener">github.com/foosel/OctoPrint/releases</a></li>
</ul>
<p>
@@ -1 +1 @@
{% filter externalize_links %}{% filter markdown %}{% filter offset_markdown_headers(2) %}{% include "_data/AUTHORS.md" ignore missing %}{% endfilter %}{% endfilter %}{% endfilter %}
{% filter externalize_links %}{% filter offset_html_headers(2) %}{% include "_data/AUTHORS.md.html" ignore missing %}{% endfilter %}{% endfilter %}
@@ -1 +0,0 @@
{% filter externalize_links %}{% filter markdown %}{% filter offset_markdown_headers(2) %}{% include "_data/CHANGELOG.md" ignore missing %}{% endfilter %}{% endfilter %}{% endfilter %}
@@ -1 +1 @@
{% filter externalize_links %}{% filter markdown %}{% filter offset_markdown_headers(2) %}{% include "_data/SUPPORTERS.md" ignore missing %}{% endfilter %}{% endfilter %}{% endfilter %}
{% filter externalize_links %}{% filter offset_html_headers(2) %}{% include "_data/SUPPORTERS.md.html" ignore missing %}{% endfilter %}{% endfilter %}
@@ -1 +1 @@
{% filter externalize_links %}{% filter markdown %}{% filter offset_markdown_headers(2) %}{% include "_data/THIRDPARTYLICENSES.md" ignore missing %}{% endfilter %}{% endfilter %}{% endfilter %}
{% filter externalize_links %}{% filter offset_html_headers(2) %}{% include "_data/THIRDPARTYLICENSES.md.html" ignore missing %}{% endfilter %}{% endfilter %}
+12
View File
@@ -94,6 +94,18 @@ class SelectedFilesLoader(BaseLoader):
return self.files.keys()
class SelectedFilesWithConversionLoader(SelectedFilesLoader):
def __init__(self, files, encoding="utf-8", conversion=None):
SelectedFilesLoader.__init__(self, files, encoding=encoding)
self.conversion = conversion
def get_source(self, environment, template):
contents = SelectedFilesLoader.get_source(self, environment, template)
if callable(self.conversion):
contents = self.conversion(contents[0]), contents[1], contents[2]
return contents
def get_all_template_paths(loader):
def walk_folder(folder):
files = []