Branch: refs/heads/master Author: Enrico Tröger enrico.troeger@uvena.de Committer: Enrico Tröger enrico.troeger@uvena.de Date: Wed, 01 May 2019 12:33:25 UTC Commit: fc112eab784990ab8cd427fee8e9937b96d1822b https://github.com/geany/www.geany.org/commit/fc112eab784990ab8cd427fee8e993...
Log Message: ----------- Render the release notes to Markdown before displaying
This looks better and more integrated instead of displaying a <pre> block which is rendered as code block.
Modified Paths: -------------- static_docs/templates/pages/documentation/releasenotes.html static_docs/views.py
Modified: static_docs/templates/pages/documentation/releasenotes.html 4 lines changed, 1 insertions(+), 3 deletions(-) =================================================================== @@ -6,9 +6,7 @@
<h2>Geany {{ selected_release.version }} ({{ selected_release.release_date }})</h2>
-<pre> -{{ selected_release.release_notes }} -</pre> +{{ selected_release.release_notes|safe }}
<h3>Older Releases</h3> <div class="row">
Modified: static_docs/views.py 12 lines changed, 11 insertions(+), 1 deletions(-) =================================================================== @@ -21,6 +21,7 @@ from django.conf import settings from django.http import Http404 from django.views.generic.base import TemplateView +from mezzanine_pagedown.filters import plain as markdown_plain
from geany.decorators import cache_function, CACHE_TIMEOUT_1HOUR, CACHE_TIMEOUT_24HOURS from static_docs.github_client import GitHubApiClient @@ -86,6 +87,9 @@ def get_context_data(self, **kwargs): # use the first element in the list which is the latest release = releases[0]
+ # convert the selected release (the one we want to display) to Markdown + release.release_notes = markdown_plain(release.release_notes) + context = super(ReleaseNotesView, self).get_context_data(**kwargs) context['selected_release'] = release context['releases'] = releases @@ -119,7 +123,13 @@ def _parse_news_file(self): releases.append(current_release) current_release_notes = list() else: - current_release_notes.append(line) + line = line.lstrip() # remove any indentation + if line and not line.startswith('*'): + # we got a section: make it bold and add an additional new line + # to make Markdown recognise the following lines as list + current_release_notes.append('**{}**\n'.format(line)) + else: + current_release_notes.append(line)
# compress the lines of the last release (the for loop ends before) current_release.release_notes = '\n'.join(current_release_notes)
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).