add the ability to specify the content license in the footer
e.g. for marking all pages as CC BY-SA 4.0 Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
@@ -44,7 +44,11 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</div>
|
||||
<footer>
|
||||
{% if extra_footer %}<div class="extra-footer"><i>{{ extra_footer|safe }}</i></div>{% endif %}
|
||||
<div class="footer"><i>Last modified: {{ mtime }}</i></div>
|
||||
<div class="footer">
|
||||
<i>Last modified: {{ mtime }}.<br />
|
||||
{% if config.LICENSE %} Available via {{ config.LICENSE|safe }}{% endif %}.
|
||||
</i>
|
||||
</div>
|
||||
</footer>
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
@@ -217,3 +217,15 @@ def test_index_in_source_link_is_stripped():
|
||||
assert '<a href=".#anchor">Anchored This Index</a>' in content
|
||||
assert '<a href="../">Parent</a>' in content
|
||||
assert '<a href="../#anchor">Anchored Parent</a>' in content
|
||||
|
||||
|
||||
def test_license_link():
|
||||
"""Test that the config's license HTML is displayed in the footer."""
|
||||
with patch('incorporealcms.Config.LICENSE',
|
||||
'<a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>', create=True):
|
||||
assert 'Available via <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>.'\
|
||||
in handle_markdown_file_path('index.md', PAGES_DIR)
|
||||
|
||||
# default, no config
|
||||
assert '<a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>'\
|
||||
not in handle_markdown_file_path('index.md', PAGES_DIR)
|
||||
|
||||
Reference in New Issue
Block a user