DetailView entry text spacing & ascii fix

This commit is contained in:
davewiththenicehat 2021-06-05 10:42:09 -04:00
parent 2e351b7fab
commit 4c0fcfbaf6
2 changed files with 6 additions and 5 deletions

View file

@ -25,7 +25,7 @@
<div class="row"> <div class="row">
<!-- left column --> <!-- left column -->
<div class="col-lg-9 col-sm-12"> <div class="col-lg-9 col-sm-12">
<p>{{ entry_text }}</p> <pre>{{ entry_text }}</pre>
{% if topic_previous or topic_next %} {% if topic_previous or topic_next %}
<hr /> <hr />

View file

@ -1,6 +1,8 @@
""" """
Views to manipulate help entries. Views to manipulate help entries.
Multi entry object type supported added by DaveWithTheNiceHat 2021
Pull Request #2429
""" """
from django.utils.text import slugify from django.utils.text import slugify
from django.conf import settings from django.conf import settings
@ -11,6 +13,7 @@ from evennia.help.models import HelpEntry
from evennia.help.filehelp import FILE_HELP_ENTRIES from evennia.help.filehelp import FILE_HELP_ENTRIES
from .mixins import TypeclassMixin from .mixins import TypeclassMixin
from evennia.utils.logger import log_info from evennia.utils.logger import log_info
from evennia.utils.ansi import strip_ansi
DEFAULT_HELP_CATEGORY = settings.DEFAULT_HELP_CATEGORY DEFAULT_HELP_CATEGORY = settings.DEFAULT_HELP_CATEGORY
@ -305,10 +308,8 @@ class HelpDetailView(HelpMixin, DetailView):
text = obj.db_entrytext text = obj.db_entrytext
elif inherits_from(obj, "evennia.help.filehelp.FileHelpEntry"): elif inherits_from(obj, "evennia.help.filehelp.FileHelpEntry"):
text = obj.entrytext text = obj.entrytext
text = text.replace("\r\n\r\n", "\n\n") text = strip_ansi(text) # remove ansii markups
text = text.replace("\r\n", "\n") context["entry_text"] = text.strip()
text = text.replace("\n", "<br />")
context["entry_text"] = text
log_info('get_context_data success') log_info('get_context_data success')
return context return context