.*)$", flags=re.MULTILINE)
+ def offset_markdown_headers(s, offset):
+ def repl(match):
+ number = len(match.group("hashs"))
+ number += offset
+ if number > 6:
+ number = 6
+ elif number < 1:
+ number = 1
+ return "{hashs} {content}".format(hashs="#" * number, content=match.group("content"))
+ return markdown_header_regex.sub(repl, s)
+
+ app.jinja_env.filters["regex_replace"] = regex_replace
+ app.jinja_env.filters["offset_html_headers"] = offset_html_headers
+ app.jinja_env.filters["offset_markdown_headers"] = offset_markdown_headers
+
# configure additional template folders for jinja2
import jinja2
import octoprint.util.jinja
@@ -651,7 +682,7 @@ class Server():
loaders = [app.jinja_loader, filesystem_loader]
if octoprint.util.is_running_from_source():
root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../.."))
- allowed = ["AUTHORS.md", "CHANGELOG.md", "THIRDPARTYLICENSES.md"]
+ allowed = ["AUTHORS.md", "CHANGELOG.md", "SPONSORS.md", "THIRDPARTYLICENSES.md"]
files = {"_data/" + name: os.path.join(root, name) for name in allowed}
loaders.append(octoprint.util.jinja.SelectedFilesLoader(files))
diff --git a/src/octoprint/server/views.py b/src/octoprint/server/views.py
index 14a8c3bc..4e8f0ffe 100644
--- a/src/octoprint/server/views.py
+++ b/src/octoprint/server/views.py
@@ -433,7 +433,8 @@ def _process_templates():
license=(gettext("OctoPrint License"), dict(template="dialogs/about/license.jinja2", _div="about_license", custom_bindings=False)),
thirdparty=(gettext("Third Party Licenses"), dict(template="dialogs/about/thirdparty.jinja2", _div="about_thirdparty", custom_bindings=False)),
authors=(gettext("Authors"), dict(template="dialogs/about/authors.jinja2", _div="about_authors", custom_bindings=False)),
- changelog=(gettext("Changelog"), dict(template="dialogs/about/changelog.jinja2", _div="about_changelog", custom_bindings=False))
+ changelog=(gettext("Changelog"), dict(template="dialogs/about/changelog.jinja2", _div="about_changelog", custom_bindings=False)),
+ sponsors = (gettext("Sponsors"), dict(template="dialogs/about/sponsors.jinja2", _div="about_sponsors", custom_bindings=False))
)
# extract data from template plugins
diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py
index a94e9072..654f6651 100644
--- a/src/octoprint/settings.py
+++ b/src/octoprint/settings.py
@@ -224,7 +224,7 @@ default_settings = {
],
"usersettings": ["access", "interface"],
"wizard": ["access"],
- "about": ["about", "license", "thirdparty", "plugin_pluginmanager", "authors", "changelog"],
+ "about": ["about", "sponsors", "authors", "changelog", "license", "thirdparty", "plugin_pluginmanager"],
"generic": []
},
"disabled": {
diff --git a/src/octoprint/templates/dialogs/about/about.jinja2 b/src/octoprint/templates/dialogs/about/about.jinja2
index 3803eba2..947c56ac 100644
--- a/src/octoprint/templates/dialogs/about/about.jinja2
+++ b/src/octoprint/templates/dialogs/about/about.jinja2
@@ -11,7 +11,7 @@
- OctoPrint is sponsored and maintained by BQ.
+ OctoPrint is sponsored by a lot of awesome people. Please see "Sponsors" to the left.
@@ -44,6 +44,5 @@
- The OctoPrint brand is a registered trademark of MundoReader, S.L
- (Trademark Rules).
+ "OctoPrint" is a registered trademark
diff --git a/src/octoprint/templates/dialogs/about/sponsors.jinja2 b/src/octoprint/templates/dialogs/about/sponsors.jinja2
new file mode 100644
index 00000000..1870c618
--- /dev/null
+++ b/src/octoprint/templates/dialogs/about/sponsors.jinja2
@@ -0,0 +1 @@
+{% filter markdown %}{% filter offset_markdown_headers(2) %}{% include "_data/SPONSORS.md" ignore missing %}{% endfilter %}{% endfilter %}