diff --git a/content_plugins/base.py b/content_plugins/base.py index 5b870a2..0a9f31b 100644 --- a/content_plugins/base.py +++ b/content_plugins/base.py @@ -141,6 +141,13 @@ class RichTextBase(StyleMixin, FilesystemTemplateRendererPlugin): def __str__(self): return Truncator(strip_tags(self.richtext)).words(10, truncate=" ...") + @property + def prepared_richtext(self): + return mark_safe(self.get_prepared_richtext(self.richtext)) + + def get_prepared_richtext(self, richtext): + return richtext + # TODO Rename to SectionBreakBase class SectionBase(StyleMixin, FilesystemTemplateRendererPlugin): @@ -262,9 +269,10 @@ class FootnoteBase(StringRendererPlugin): class RichTextFootnoteMixin: MATCH_FOOTNOTES = re.compile("(\w+)") - def render(self): + def get_prepared_richtext(self, richtext): # Find all footnotes and convert them into links + richtext = super().get_prepared_richtext(richtext) rv = self.MATCH_FOOTNOTES.subn( '\" class="footnote">\">\g<1>', - self.richtext)[0] - return mark_safe(rv) + richtext)[0] + return rv