diff --git a/core/forms.py b/core/forms.py index 2781c67..896a655 100644 --- a/core/forms.py +++ b/core/forms.py @@ -15,9 +15,7 @@ from troggle.core.models.caves import Cave, LogbookEntry, QM, Entrance, CaveAndE Some are not used and need renovating or destroying. ''' -todo = '''Remove UploadFileForm - replace by Simple variant -Re engineer Simple upload to not use a Django form object - +todo = '''Re-enable TinyMCE ''' class CaveForm(ModelForm): diff --git a/core/middleware.py b/core/middleware.py index 91e64ec..e87662e 100644 --- a/core/middleware.py +++ b/core/middleware.py @@ -2,9 +2,11 @@ from django.conf import settings from django import http from django.urls import reverse, resolve,Resolver404 """Non-standard django middleware is loaded from this file. -It needs re-writing to be compatible with Django v2.0+ -""" +""" +todo = '''SmartAppendSlashMiddleware(object) Not Working. +It needs re-writing to be compatible with Django v2.0 and later +''' class SmartAppendSlashMiddleware(object): """ "SmartAppendSlash" middleware for taking care of URL rewriting. diff --git a/core/templatetags/csrffaker.py b/core/templatetags/csrffaker.py deleted file mode 100644 index 6186369..0000000 --- a/core/templatetags/csrffaker.py +++ /dev/null @@ -1,10 +0,0 @@ -import django -from django import template - -register = template.Library() -# if django.VERSION[0] >=1 and django.VERSION[1] > 1: - # pass -# else: - - # @register.simple_tag - # def csrf_token(): return "" diff --git a/core/templatetags/survex_markup.py b/core/templatetags/survex_markup.py deleted file mode 100644 index 35b2670..0000000 --- a/core/templatetags/survex_markup.py +++ /dev/null @@ -1,63 +0,0 @@ -from django import template -from django.utils.html import conditional_escape -from django.template.defaultfilters import stringfilter -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. - - - -regexes = [] -regexes.append((re.compile(r"(;.*)$", re.IGNORECASE|re.MULTILINE), - r'\1\n')) -regexes.append((re.compile(r"^(\s*)(\*include)(\s+)([^\s]*)(.svx)$", re.IGNORECASE|re.MULTILINE), - r'\1\2\3\4\5')) -regexes.append((re.compile(r"^(\s*)(\*include)(\s+)([^\s]*)$", re.IGNORECASE|re.MULTILINE), - r'\1\2\3\4')) -regexes.append((re.compile(r"^(\s*)(\*team\s+(?:notes|tape|insts|pics))(\s+)(.*)$", re.IGNORECASE|re.MULTILINE), - r'\1\2\3\4')) -regexes.append((re.compile(r"^(\s*)(\*(?:begin|end|copyright|date|entrance|equate|export|fix|prefix|require|SOLVE|title|truncate))(\s+)(.*)$", re.IGNORECASE|re.MULTILINE), - r'\1\2\3\4')) -regexes.append((re.compile(r"^(\s*)(\*calibrate\s+(?:TAPE|COMPASS|CLINO|COUNTER|DEPTH|DECLINATION|X|Y|Z)+)(\s+)(.*)$", re.IGNORECASE|re.MULTILINE), - r'\1\2\3\4')) -regexes.append((re.compile(r"^(\s*)(\*data\s+(?:DEFAULT|NORMAL|DIVING|CARTESIAN|TOPOFIL|CYLPOLAR|NOSURVEY|passage)(?:\s+station|\s+from|\s+to|\s+FROMDEPTH|\s+TODEPTH|\s+DEPTHCHANGE|\s+newline|\s+direction|\s+tape|\s+compass|\s+clino|\s+northing|\s+easting|\s+altitude|\s+length|\s+bearing|\s+gradient|\s+ignoreall|\sleft|\sright|\sup|\sdown)*)$", re.IGNORECASE|re.MULTILINE), - r'\1\2')) -regexes.append((re.compile(r"^(\s*)(\*default\s+(?:CALIBRATE|DATA|UNITS)+)(\s+)(.*)$", re.IGNORECASE|re.MULTILINE), - r'\1\2\3\4')) -regexes.append((re.compile(r"^(\s*)(\*flags\s+(?:DUPLICATE|SPLAY|SURFACE|not DUPLICATE|not SPLAY|not SURFACE))(\s+)(.*)$", re.IGNORECASE|re.MULTILINE), - r'\1\2\3\4')) -regexes.append((re.compile(r"^(\s*)(\*infer\s+(?:plumbs|equates|exports))(\s+)(.*)$", re.IGNORECASE|re.MULTILINE), - r'\1\2\3\4')) -regexes.append((re.compile(r"^(\s*)(\*instrument\s+(?:compass|clino|tape))(\s+)(.*)$", re.IGNORECASE|re.MULTILINE), - r'\1\2\3\4')) -regexes.append((re.compile(r"^(\s*)(\*instrument\s+(?:compass|clino|tape))(\s+)(.*)$", re.IGNORECASE|re.MULTILINE), - r'\1\2\3\4')) -regexes.append((re.compile(r"^(\s*)(\*sd\s+(?:TAPE|COMPASS|CLINO|COUNTER|DEPTH|DECLINATION|DX|DY|DZ))(\s+)(.*)$", re.IGNORECASE|re.MULTILINE), - r'\1\2\3\4')) -regexes.append((re.compile(r"^(\s*)(\*set\s+(?:BLANK|COMMENT|DECIMAL|EOL|KEYWORD|MINUS|NAMES|OMIT|PLUS|ROOT|SEPARATOR))(\s+)(.*)$", re.IGNORECASE|re.MULTILINE), - r'\1\2\3\4')) -regexes.append((re.compile(r"^(\s*)(\*units\s+(?:TAPE|LENGTH|COMPASS|BEARING|CLINO|GRADIENT|COUNTER|DEPTH|DECLINATION|X|Y|Z))(\s+)(.*)$", re.IGNORECASE|re.MULTILINE), - r'\1\2\3\4')) -regexes.append((re.compile(r"^(.*)$", re.IGNORECASE|re.MULTILINE), - r'
" - outValue += wiki_to_html_short(paragraph, autoescape) - outValue += "
\n" - return mark_safe(outValue) - -@register.filter() -@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. - - 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) - #deescape doubly escaped characters - value = re.sub("&(.*?);", r"&\1;", value, re.DOTALL) - #italics and bold - value = re.sub("''''([^']+)''''", r"\1", value, re.DOTALL) - value = re.sub("'b''([^']+)'''", r"\1", value, re.DOTALL) - value = re.sub("''([^']+)''", r"\1", value, re.DOTALL) - - #make headers - def headerrepl(matchobj): - number=len(matchobj.groups()[0]) - num=str(number) - if number>1: - return '