forked from expo/troggle
cleaned & removed defunct wiki_to_html
This commit is contained in:
parent
be0148d146
commit
b545f8ed40
@ -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),
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
@ -36,7 +36,7 @@
|
||||
<a href="{% url "dwgdata" %}">Drawings</a> |
|
||||
<a href="/1623/290/290.html">290 (FGH)</a> |
|
||||
<a href="/1623/291/291">291 (GSH)</a> |
|
||||
<a href="/1623/204/204.html">204 (Steinbrucken)</a> |
|
||||
<a href="/1623/204/204.html">204 (Steinbrücken)</a> |
|
||||
<br>
|
||||
|
||||
<a href="{% url "dataissues" %}">Data Issues</a> |
|
||||
|
@ -1,79 +1,77 @@
|
||||
{% extends "base.html" %}
|
||||
{% load wiki_markup %}
|
||||
|
||||
{% block title %}{{ cave.official_name|wiki_to_html }} - {{ entrance_letter|wiki_to_html }}{% endblock %}
|
||||
{% block title %}{{ cave.official_name|safe }} - {{ entrance_letter|safe }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<table id="cavepage">
|
||||
<tr>
|
||||
<th id="kat_no">
|
||||
{% if cave.kataster_number %}
|
||||
{{ cave.kataster_number|wiki_to_html }}{{ letter|wiki_to_html }}
|
||||
{{ cave.kataster_number|safe }}{{ letter|safe }}
|
||||
{% if cave.unofficial_number %}
|
||||
<br />({{ cave.unofficial_number|wiki_to_html }})
|
||||
<br />({{ cave.unofficial_number|safe }})
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</th>
|
||||
<th id="name">
|
||||
{% if entrance.name %}
|
||||
{{ entrance.name|wiki_to_html }}
|
||||
{{ entrance.name|safe }}
|
||||
{% else %}
|
||||
Unnamed
|
||||
{% endif %} - {{ cave.official_name|wiki_to_html }}
|
||||
{% endif %} - {{ cave.official_name|safe }}
|
||||
</th>
|
||||
<th id="status">
|
||||
{{ cave.kataster_code|wiki_to_html }}
|
||||
{{ cave.kataster_code|safe }}
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{% if entrance.entrance_description %}
|
||||
<h2>Entrance Description</h2>
|
||||
{{ entrance.entrance_description|wiki_to_html }}
|
||||
{{ entrance.entrance_description|safe }}
|
||||
{% endif %}
|
||||
{% if entrance.explorers %}
|
||||
<h2>Explorers</h2>
|
||||
{{ entrance.explorers|wiki_to_html }}
|
||||
{{ entrance.explorers|safe }}
|
||||
{% endif %}
|
||||
{% if entrance.map_description %}
|
||||
<h2>Map</h2>
|
||||
{{ entrance.map_description|wiki_to_html }}
|
||||
{{ entrance.map_description|safe }}
|
||||
{% endif %}
|
||||
{% if entrance.explorers %}
|
||||
<h2>Entrance Description</h2>
|
||||
{{ entrance.entrance_description|wiki_to_html }}
|
||||
{{ entrance.entrance_description|safe }}
|
||||
{% endif %}
|
||||
{% if entrance.location_description %}
|
||||
<h2>Location Description</h2>
|
||||
{{ entrance.location_description|wiki_to_html }}
|
||||
{{ entrance.location_description|safe }}
|
||||
{% endif %}
|
||||
{% if entrance.approach %}
|
||||
<h2>Approach</h2>
|
||||
{{ entrance.approach|wiki_to_html }}
|
||||
{{ entrance.approach|safe }}
|
||||
{% endif %}
|
||||
{% if entrance.underground_description %}
|
||||
<h2>Underground Description</h2>
|
||||
{{ entrance.underground_description|wiki_to_html }}
|
||||
{{ entrance.underground_description|safe }}
|
||||
{% endif %}
|
||||
{% if entrance.photo %}
|
||||
<h2>Photo</h2>
|
||||
{{ entrance.photo|wiki_to_html }}
|
||||
{{ entrance.photo|safe }}
|
||||
{% endif %}
|
||||
{% if entrance.marking %}
|
||||
<h2>Marking - {{ entrance.marking_val|wiki_to_html }}</h2>
|
||||
<h2>Marking - {{ entrance.marking_val|safe }}</h2>
|
||||
{% if entrance.marking_comment %}
|
||||
{{ entrance.marking_comment|wiki_to_html }}
|
||||
{{ entrance.marking_comment|safe }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if entrance.findability %}
|
||||
<h2>Findability - {{ entrance.findability_val|wiki_to_html }}</h2>
|
||||
<h2>Findability - {{ entrance.findability_val|safe }}</h2>
|
||||
{% if entrance.findability_description %}
|
||||
{{ entrance.findability_description|wiki_to_html }}
|
||||
{{ entrance.findability_description|safe }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if entrance.bearings %}
|
||||
<h2>Bearings</h2>
|
||||
{{ entrance.bearings|wiki_to_html }}
|
||||
{{ entrance.bearings|safe }}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,7 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
{% load wiki_markup %}
|
||||
{% block title %}Expedition {{expedition.name}}{% endblock %}
|
||||
{% block editLink %}<a href={{expedition.get_admin_url}}>Edit expedition {{expedition|wiki_to_html_short}}</a>{% endblock %}
|
||||
{% block editLink %}<a href={{expedition.get_admin_url}}>Edit expedition {{expedition}}</a>{% endblock %}
|
||||
|
||||
{% block related %}
|
||||
{% endblock %}
|
||||
|
@ -1,9 +1,9 @@
|
||||
{% extends "base.html" %}
|
||||
<!-- logbookentry.html - this text visible because this template has been included -->
|
||||
{% load wiki_markup %}
|
||||
|
||||
{% block title %}Logbook {{logbookentry.id}}{% endblock %}
|
||||
{% block editLink %}<a href={{logbookentry.get_admin_url}}/>Edit logbook entry {{logbookentry|wiki_to_html_short}}</a>{% endblock %}
|
||||
|
||||
{% block editLink %}<a href={{logbookentry.get_admin_url}}/>Edit logbook entry {{logbookentry|safe}}</a>{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% block related %}{% endblock %}
|
||||
|
@ -1,5 +1,4 @@
|
||||
{% extends "base.html" %}
|
||||
{% load wiki_markup %}
|
||||
{% block title %}Person Index{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
@ -9,7 +8,7 @@
|
||||
<tr><th>Person</th><th>First</th><th>Last</th><th>Recency</th></tr>
|
||||
{% for person in notablepersons|dictsortreversed:"notability" %}
|
||||
<tr>
|
||||
<td><a href="{{ person.get_absolute_url }}">{{person|wiki_to_html_short}}</a></td>
|
||||
<td><a href="{{ person.get_absolute_url }}">{{person|safe}}</a></td>
|
||||
<td><a href="{{ person.first.get_absolute_url }}">{{ person.first.expedition.year }}</a></td>
|
||||
<td><a href="{{ person.last.get_absolute_url }}">{{ person.last.expedition.year }}</a></td>
|
||||
<td style="text-align:right">{{person.notability|floatformat:2}}</td>
|
||||
@ -29,7 +28,7 @@
|
||||
<tr><th>Person</th><th>First</th><th>Last</th><th>Surveyed length</th></tr>
|
||||
{% for person in persons %}
|
||||
<tr>
|
||||
<td><a href="{{ person.get_absolute_url }}">{{person|wiki_to_html_short}}</a></td>
|
||||
<td><a href="{{ person.get_absolute_url }}">{{person|safe}}</a></td>
|
||||
<td><a href="{{ person.first.get_absolute_url }}">{{person.first.expedition.year}}</a></td>
|
||||
<td><a href="{{ person.last.get_absolute_url }}">{{person.last.expedition.year}}</a></td>
|
||||
<td style="text-align:right">{{person.surveyedleglength|stringformat:".0f"}} m </td>
|
||||
|
@ -1,11 +1,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% load wiki_markup %}
|
||||
{% block title %}Person {{person|wiki_to_html_short}}{% endblock %}
|
||||
{% block title %}Person {{person}}{% endblock %}
|
||||
|
||||
{% block editLink %}| <a href={{person.get_admin_url}}>Edit person {{person|wiki_to_html_short}}</a>{% endblock %}
|
||||
{% block editLink %}| <a href={{person.get_admin_url}}>Edit person {{person}}</a>{% endblock %}
|
||||
|
||||
{% block contentheader %}
|
||||
<h2> {{person|wiki_to_html_short}} </h2>
|
||||
<h2> {{person|safe}} </h2>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
@ -19,7 +18,7 @@
|
||||
{% endif %}
|
||||
<br class="clearfloat" />
|
||||
|
||||
<h3>{{person|wiki_to_html_short}} has been on expo in the following years:</h3>
|
||||
<h3>{{person|safe}} has been on expo in the following years:</h3>
|
||||
<p>
|
||||
<ul>
|
||||
{% for personexpedition in person.personexpedition_set.all %}
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
{% load wiki_markup %}
|
||||
{% block title %}Person {{personexpedition.person|wiki_to_html_short}} for {{personexpedition.expedition}}{% endblock %}
|
||||
{% block title %}Person {{personexpedition.person}} for {{personexpedition.expedition}}{% endblock %}
|
||||
<!-- I am removing 'role' as a thing that troggle cares about.
|
||||
This will remove the Class Role (but keep PersonRole)
|
||||
and 1 foreign key role
|
||||
|
@ -1,9 +1,8 @@
|
||||
{% extends "base.html" %}
|
||||
{% load wiki_markup %}
|
||||
{% load link %}
|
||||
{% block title %} QM: {{qm|wiki_to_html_short}} {% endblock %}
|
||||
{% block title %} QM: {{qm|safe}} {% endblock %}
|
||||
|
||||
{% block editLink %}| <a href={{qm.get_admin_url}}>Edit QM {{qm|wiki_to_html_short}}</a>{% endblock %}
|
||||
{% block editLink %}| <a href={{qm.get_admin_url}}>Edit QM {{qm|safe}}</a>{% endblock %}
|
||||
|
||||
|
||||
|
||||
@ -11,7 +10,7 @@
|
||||
<table id="cavepage">
|
||||
<tr>
|
||||
<th id="kat_no"><a href="{{qm.get_previous_by_id.get_absolute_url}}">Previous</a></th>
|
||||
<th id="name">{{qm|wiki_to_html_short}}</th>
|
||||
<th id="name">{{qm|safe}}</th>
|
||||
<th id="status"><a href="{{qm.get_next_by_id.get_absolute_url}}">Next</a></th>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<!-- svxcaveseveral.html - this text visible because this template has been included -->
|
||||
{% extends "base.html" %}
|
||||
{% block title %}List of survex files{% endblock %}
|
||||
{% load wiki_markup %}
|
||||
{% block content %}
|
||||
<!-- the only thing passed into this template is a list of object identifiers for caves.
|
||||
All the processing to extract the survex subdriectories and survex files is done in this template -->
|
||||
@ -45,9 +44,9 @@
|
||||
{% for survexfile in survexdirectory.survexfile_set.all %}
|
||||
<tr>
|
||||
{% if survexfile.exists %}
|
||||
<td rowspan="{{survexfile.survexblock_set.all|length|plusone}}">
|
||||
<td rowspan="{{survexfile.survexblock_set.all|length|add:"1"}}">
|
||||
{% else %}
|
||||
<td class="survexnewfile" rowspan="{{survexfile.survexblock_set.all|length|plusone}}">
|
||||
<td class="survexnewfile" rowspan="{{survexfile.survexblock_set.all|length|add:"1"}}">
|
||||
{% endif %}
|
||||
|
||||
{% if survexfile == survexdirectory.primarysurvexfile %}
|
||||
|
@ -1,7 +1,6 @@
|
||||
<!-- svxcavesingle.html - this text visible because this template has been included -->
|
||||
{% extends "base.html" %}
|
||||
{% block title %}List of survex files{% endblock %}
|
||||
{% load wiki_markup %}
|
||||
{% block content %}
|
||||
|
||||
{% autoescape off %}
|
||||
@ -45,9 +44,9 @@ to go to a form to correct the online data.
|
||||
{% for survexfile in survexdirectory.survexfile_set.all %}
|
||||
<tr>
|
||||
{% if survexfile.exists %}
|
||||
<td rowspan="{{survexfile.survexblock_set.all|length|plusone}}">
|
||||
<td rowspan="{{survexfile.survexblock_set.all|length|add:"1"}}">
|
||||
{% else %}
|
||||
<td class="survexnewfile" rowspan="{{survexfile.survexblock_set.all|length|plusone}}">
|
||||
<td class="survexnewfile" rowspan="{{survexfile.survexblock_set.all|length|add:"1"}}">
|
||||
{% endif %}
|
||||
|
||||
{% if survexfile == survexdirectory.primarysurvexfile %}
|
||||
|
Loading…
Reference in New Issue
Block a user