From 6846328d47a0348d69f8d0e6180a6ff28c31b240 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Sun, 5 Jan 2020 18:38:13 +0100 Subject: [PATCH] Add release note, consistently call it "editsection", missing r'..' --- docs/release_notes.rst | 5 +++++ docs/settings.rst | 2 +- src/wiki/plugins/editsection/views.py | 10 ++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/release_notes.rst b/docs/release_notes.rst index 5bfb2f58..79c1b8d1 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -15,6 +15,11 @@ Release plan 0.5.1.dev --------- +Added +~~~~~ + +* New plugin ``wiki.plugins.editsection`` displays an ``[edit]`` link next to section headers (Frank Loemker) :url-issue:`652` + Fixed ~~~~~ diff --git a/docs/settings.rst b/docs/settings.rst index 9a279057..b7598f4a 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -16,7 +16,7 @@ Plugin attachments .. automodule:: wiki.plugins.attachments.settings :members: -Plugin editSection +Plugin editsection ------------------ .. automodule:: wiki.plugins.editsection.settings diff --git a/src/wiki/plugins/editsection/views.py b/src/wiki/plugins/editsection/views.py index 259b3917..ca4d3916 100644 --- a/src/wiki/plugins/editsection/views.py +++ b/src/wiki/plugins/editsection/views.py @@ -1,4 +1,5 @@ import re + from django.contrib import messages from django.shortcuts import get_object_or_404, redirect from django.utils.decorators import method_decorator @@ -7,8 +8,9 @@ from wiki import models from wiki.core.markdown import article_markdown from wiki.core.plugins.registry import get_markdown_extensions from wiki.decorators import get_article -from wiki.views.article import Edit as EditView from wiki.plugins.editsection.markdown_extensions import EditSectionExtension +from wiki.views.article import Edit as EditView + from . import settings @@ -21,7 +23,7 @@ class FindHeader: SETEXT_RE_TEXT = r'(?P.*?)\n(?P[=-])+[ ]*(\n|$)' SETEXT_RE = re.compile(r'\n%s' % SETEXT_RE_TEXT, re.MULTILINE) HEADER_RE = re.compile(r'((\A ?\n?|\n(?![^\n]{0,3}\w).*?\n)%s' - '|(\A|\n)(?P#{1,6})(?P.*?)#*(\n|$))' % SETEXT_RE_TEXT, re.MULTILINE) + r'|(\A|\n)(?P#{1,6})(?P.*?)#*(\n|$))' % SETEXT_RE_TEXT, re.MULTILINE) ATTR_RE = re.compile(r'[ ]+\{\:?([^\}\n]*)\}[ ]*$') def __init__(self, text, pos): @@ -105,7 +107,7 @@ class EditSection(EditView): self.orig_section = text[location[0]:location[1]] # Pass the to be used content to EditSection kwargs['content'] = self.orig_section - request.session['editSection_content'] = self.orig_section + request.session['editsection_content'] = self.orig_section else: messages.error( request, @@ -114,7 +116,7 @@ class EditSection(EditView): ) return redirect('wiki:get', path=self.urlpath.path) else: - kwargs['content'] = request.session.get('editSection_content') + kwargs['content'] = request.session.get('editsection_content') self.orig_section = kwargs.get('content') return super().dispatch(request, article, *args, **kwargs) -- 2.45.2