diff --git a/core/templatetags/wiki_markup.py b/core/templatetags/wiki_markup.py index 276586a..966853d 100644 --- a/core/templatetags/wiki_markup.py +++ b/core/templatetags/wiki_markup.py @@ -6,20 +6,29 @@ from django.conf import settings from troggle.core.models.caves import LogbookEntry, QM, Cave import re, urllib.parse -register = template.Library() -'''Several templates are still (2021) using these wiki filters extensively to process data extracted from the database, -and to restructure values into valid URLs to go elsewhere in the system, even where these are not actually 'wiki'. See -the regexes at the end of this file. -So the data in the database needs to be checked that there is no wiki-format content before these are deleted, and the -filter functions of these regexes needs to be explored in practice. +'''Several templates are still (2021) using these filters extensively to process data +extracted from the database, and to restructure values into valid URLs to go elsewhere in the +system, even where these are not actually 'wiki'. See the regexes at the end of this file. + ''' +todo = '''The data in the database and all input files +needs to be checked that there is no wiki-format content before all the functions in this +file are deleted, and the filter functions of these regexes and functions, particularly +wiki_to_html() which is used dozens of times in the templates, needs to be explored in +practice before being renamed more appropriately. +''' +register = template.Library() + @register.filter() def plusone(n): + '''used in templates/svxcaveseveral.html and templates/svxcavessingle.html for formatting + ''' return n + 1 def wiki_list(line, listdepth): + '''Does not seem to be used anywhere except photoSrcRepl() below''' l = "" for d in listdepth: l += d @@ -50,6 +59,9 @@ def wiki_to_html(value, autoescape=None): """ This is the tag which turns wiki syntax into html. It is intended for long pieces of wiki. Hence it splits the wiki into HTML paragraphs based on double line feeds. + + But it is used as a filter when rendering many, many fields, e.g. + epersonexpedition.person|wiki_to_html_short in presonexpedition.html """ #find paragraphs outValue = "" @@ -65,6 +77,10 @@ def wiki_to_html_short(value, autoescape=None): """ This is the tag which turns wiki syntax into html. It is intended for short pieces of wiki. Hence it is not split the wiki into paragraphs using where it finds double line feeds. + + But it is used as a filter when rendering many, many fields, e.g. + entrance.entrance_description|wiki_to_html in extrance.html + """ if autoescape: value = conditional_escape(value) @@ -120,6 +136,7 @@ def wiki_to_html_short(value, autoescape=None): photoLinkPattern="\[\[\s*photo:(?P[^\s]+)\s*(?P.*)\]\]" photoSrcPattern="\[\[\s*display:(?P