cleaned & removed defunct wiki_to_html

This commit is contained in:
Philip Sargent
2021-04-30 22:44:03 +01:00
parent be0148d146
commit b545f8ed40
13 changed files with 53 additions and 61 deletions

View File

@@ -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),

View File

@@ -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.

View File

@@ -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