2026.01.02 09:13:10 (cachyos.cmoser.eu)
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
import bbcode
|
import bbcode
|
||||||
from . import formatters
|
from . import formatters
|
||||||
|
from ... import settings
|
||||||
PARSER = bbcode.Parser(newline="\n",escape_html=True,replace_links=False)
|
PARSER = bbcode.Parser(newline="\n",escape_html=True,replace_links=False)
|
||||||
|
|
||||||
def _():
|
def _():
|
||||||
for i in formatters.SIMPLE_FORMATTERS:
|
def add_simple_formatters(simple_formatters):
|
||||||
|
for i in simple_formatters:
|
||||||
if len(i) == 0:
|
if len(i) == 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -13,6 +15,7 @@ def _():
|
|||||||
kwargs = i[1]
|
kwargs = i[1]
|
||||||
PARSER.add_simple_formatter(*i[0], **kwargs)
|
PARSER.add_simple_formatter(*i[0], **kwargs)
|
||||||
|
|
||||||
|
def add_formatters(formatters):
|
||||||
for i in formatters.FORMATTERS:
|
for i in formatters.FORMATTERS:
|
||||||
if len(i) == 0:
|
if len(i) == 0:
|
||||||
continue
|
continue
|
||||||
@@ -24,5 +27,12 @@ def _():
|
|||||||
|
|
||||||
PARSER.add_formatter(*i[0], **kwargs)
|
PARSER.add_formatter(*i[0], **kwargs)
|
||||||
|
|
||||||
|
add_simple_formatters(formatters.SIMPLE_FORMATTERS)
|
||||||
|
add_formatters(formatters.FORMATTERS)
|
||||||
|
if settings.TINYWIKI_BBCODE_EXTR_SIMPLE_FORMATTERS:
|
||||||
|
add_simple_formatters(settings.TINYWIKI_BBCODE_EXTR_SIMPLE_FORMATTERS)
|
||||||
|
if settings.TINYWIKI_BBCODE_EXTRA_FORMATTERS:
|
||||||
|
add_formatters(settings.TINYWIKI_BBCODE_EXTRA_FORMATTERS)
|
||||||
|
|
||||||
_()
|
_()
|
||||||
del _
|
del _
|
||||||
@@ -464,10 +464,10 @@ def render_youtube_video(tag_name: str, value, options, parent, context):
|
|||||||
div_classes += ["mx-auto", "d-block"]
|
div_classes += ["mx-auto", "d-block"]
|
||||||
# classes += ["mx-auto", "d-block"]
|
# classes += ["mx-auto", "d-block"]
|
||||||
|
|
||||||
if styles:
|
# if styles:
|
||||||
style = f"style=\"{' '.join(styles)}\""
|
# style = f"style=\"{' '.join(styles)}\""
|
||||||
else:
|
# else:
|
||||||
style = ""
|
# style = ""
|
||||||
|
|
||||||
if div_styles:
|
if div_styles:
|
||||||
div_style = f'style="{"".join(div_styles)}"'
|
div_style = f'style="{"".join(div_styles)}"'
|
||||||
|
|||||||
@@ -35,5 +35,7 @@ TINYWIKI_BASE_TEMPLATE = getattr(
|
|||||||
)
|
)
|
||||||
|
|
||||||
TINYWIKI_HOME = getattr(settings, "TINYWIKI_HOME", "tw-home")
|
TINYWIKI_HOME = getattr(settings, "TINYWIKI_HOME", "tw-home")
|
||||||
|
TINYWIKI_BBCODE_EXTRA_FORMATTERS = getattr(settings, 'TINYWIKI_BBCODE_EXTRA_FORMATTERS', None)
|
||||||
|
TINYWIKI_BBCODE_EXTR_SIMPLE_FORMATTERS = getattr(settings, 'TINYWIKI_BBCODE_EXTR_SIMPLE_FORMATTERS', None)
|
||||||
|
|
||||||
USE_BOOTSTRAP = getattr(settings, "USE_BOOTSTRAP", False)
|
USE_BOOTSTRAP = getattr(settings, "USE_BOOTSTRAP", False)
|
||||||
|
|||||||
Reference in New Issue
Block a user