diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/templatetags/survex_markup.py | 12 | ||||
-rw-r--r-- | core/templatetags/wiki_markup.py | 15 | ||||
-rw-r--r-- | core/views/other.py | 4 |
3 files changed, 16 insertions, 15 deletions
diff --git a/core/templatetags/survex_markup.py b/core/templatetags/survex_markup.py index 94ba97d..35b2670 100644 --- a/core/templatetags/survex_markup.py +++ b/core/templatetags/survex_markup.py @@ -5,14 +5,18 @@ from django.utils.safestring import mark_safe import re register = template.Library() +'''Now entirely defunct. +Simple use in svxfile.html produced a textarea, double-spacing and no colouring. +so this would take some work, and we are better off not using it but getting +syntax colouring to work with CodeMirror instead. PPhilip S. 28 March 2021. + +The only template which used it, survexblock.html, has been removed as unnecessary. + +''' # seems to add extra lines between the commented lines, which isn't so great. -# Simple use in svxfile.html produces a textarea, double-spacing and no colouring. -# so this is going to take some work, and we are better off not using it but getting -# syntax colouring to work with CodeMirror instead. PPhilip S. 28 March 2021. -# The only template which used it, survexblock.html, has been removed as unnecessary. regexes = [] regexes.append((re.compile(r"(;.*)$", re.IGNORECASE|re.MULTILINE), diff --git a/core/templatetags/wiki_markup.py b/core/templatetags/wiki_markup.py index 7e9a4b1..f1ab69d 100644 --- a/core/templatetags/wiki_markup.py +++ b/core/templatetags/wiki_markup.py @@ -6,16 +6,11 @@ from django.conf import settings from troggle.core.models.caves import LogbookEntry, QM, Cave import re, urllib.parse -'''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. +'''Originally for the wiki format entries, later re-used simply to clean up HTML escape chars. +Now entirely defunct. ''' -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. +todo = '''Checked. Not used anywhere anymore. Replaced by standard Django template filters. ''' register = template.Library() @@ -75,6 +70,10 @@ def wiki_to_html(value, autoescape=None): @stringfilter def wiki_to_html_short(value, autoescape=None): """ + I suspect this is only used for HTML escapes. And we should be using the standard Django + filter |safe https://docs.djangoproject.com/en/dev/ref/templates/builtins/#safe + + 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. diff --git a/core/views/other.py b/core/views/other.py index d3d1126..748869e 100644 --- a/core/views/other.py +++ b/core/views/other.py @@ -46,7 +46,6 @@ def todos(request, module): from troggle.parsers.survex import todo as parserssurvex from troggle.core.models.caves import todo as modelcaves from troggle.core.forms import todo as forms - from troggle.core.templatetags.wiki_markup import todo as wiki tododict = {'views/other': todo, 'tests': tests, 'views/logbooks': viewlogbooks, @@ -54,8 +53,7 @@ def todos(request, module): 'parsers/logbooks': parserslogbooks, 'parsers/survex': parserssurvex, 'core/models/caves': modelcaves, - 'core/forms': forms, - 'core/templatetags/wiki_markup': wiki} + 'core/forms': forms} return render(request,'core/todos.html', {'tododict': tododict}) def troggle404(request): # cannot get this to work. Handler404 in urls.py not right syntax |