punkweb-bb 0.3.0__py3-none-any.whl → 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- punkweb_bb/__pycache__/admin.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/admin_forms.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/bbcode.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/forms.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/middleware.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/mixins.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/models.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/pagination.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/parsers.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/response.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/settings.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/signals.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/tags.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/tests.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/urls.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/utils.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/views.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/widgets.cpython-311.pyc +0 -0
- punkweb_bb/admin.py +0 -1
- punkweb_bb/bbcode.py +155 -0
- punkweb_bb/settings.py +1 -1
- punkweb_bb/static/punkweb_bb/css/defaults.css +2 -2
- punkweb_bb/static/punkweb_bb/css/punkweb-modal.css +2 -0
- punkweb_bb/static/punkweb_bb/css/punkweb.css +2 -2
- punkweb_bb/static/punkweb_bb/css/subcategory.css +4 -0
- punkweb_bb/static/punkweb_bb/editor/bbcode-editor-content.css +4 -5
- punkweb_bb/static/punkweb_bb/editor/bbcode-editor.js +0 -5
- punkweb_bb/static/punkweb_bb/editor/markdown-editor.js +38 -12
- punkweb_bb/templates/punkweb_bb/bbcode.html +2 -3
- punkweb_bb/templates/punkweb_bb/shoutbox/shout_list.html +2 -2
- punkweb_bb/templates/punkweb_bb/widgets/markdown-editor.html +1 -0
- punkweb_bb/templatetags/__pycache__/render.cpython-311.pyc +0 -0
- punkweb_bb/templatetags/__pycache__/shoutbox_render.cpython-311.pyc +0 -0
- punkweb_bb/templatetags/render.py +16 -29
- punkweb_bb/utils.py +17 -19
- punkweb_bb/views.py +10 -19
- {punkweb_bb-0.3.0.dist-info → punkweb_bb-0.4.0.dist-info}/METADATA +10 -18
- {punkweb_bb-0.3.0.dist-info → punkweb_bb-0.4.0.dist-info}/RECORD +41 -41
- punkweb_bb/bbcode_tags.py +0 -167
- punkweb_bb/parsers.py +0 -70
- punkweb_bb/templatetags/shoutbox_render.py +0 -22
- {punkweb_bb-0.3.0.dist-info → punkweb_bb-0.4.0.dist-info}/LICENSE +0 -0
- {punkweb_bb-0.3.0.dist-info → punkweb_bb-0.4.0.dist-info}/WHEEL +0 -0
- {punkweb_bb-0.3.0.dist-info → punkweb_bb-0.4.0.dist-info}/top_level.txt +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
punkweb_bb/admin.py
CHANGED
punkweb_bb/bbcode.py
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import bbcode
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def render_color(name, value, options, parent, context):
|
|
5
|
+
if "color" in options:
|
|
6
|
+
color = options["color"].strip()
|
|
7
|
+
return f'<span style="color: {color}">{value}</span>'
|
|
8
|
+
return value
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def render_shadow(name, value, options, parent, context):
|
|
12
|
+
if "shadow" in options:
|
|
13
|
+
shadow = options["shadow"].strip()
|
|
14
|
+
return f'<span id="bbcode-shadow" style="text-shadow: 0px 0px 1em {shadow}">{value}</span>'
|
|
15
|
+
return value
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def render_font(name, value, options, parent, context):
|
|
19
|
+
if "font" in options:
|
|
20
|
+
font = options["font"].strip()
|
|
21
|
+
return f'<span style="font-family:{font};">{value}</span>'
|
|
22
|
+
return value
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def render_quote(name, value, options, parent, context):
|
|
26
|
+
if "quote" in options:
|
|
27
|
+
return f'<blockquote><cite>{options["quote"]} said: </cite>{value}</blockquote>'
|
|
28
|
+
return f"<blockquote>{value}</blockquote>"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def render_code(name, value, options, parent, context):
|
|
32
|
+
if "code" in options:
|
|
33
|
+
language = options["code"].strip()
|
|
34
|
+
return f'<pre><code class="language-{language}">{value}</code></pre>'
|
|
35
|
+
return f"<pre><code>{value}</code></pre>"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def render_img(name, value, options, parent, context):
|
|
39
|
+
if "width" in options:
|
|
40
|
+
width = options["width"]
|
|
41
|
+
if "height" in options:
|
|
42
|
+
height = options["height"]
|
|
43
|
+
|
|
44
|
+
if "width" in options and "height" in options:
|
|
45
|
+
return f'<img src="{value}" alt="{value}" width="{width}" height="{height}" />'
|
|
46
|
+
elif "width" in options:
|
|
47
|
+
return f'<img src="{value}" alt="{value}" width="{width}" />'
|
|
48
|
+
elif "height" in options:
|
|
49
|
+
return f'<img src="{value}" alt="{value}" height="{height}" />'
|
|
50
|
+
|
|
51
|
+
return f'<img src="{value}" alt="{value}" />'
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def render_url(name, value, options, parent, context):
|
|
55
|
+
if "url" in options:
|
|
56
|
+
url = options["url"]
|
|
57
|
+
return f'<a href="{url}">{value}</a>'
|
|
58
|
+
return f'<a href="{value}">{value}</a>'
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def render_size(name, value, options, parent, context):
|
|
62
|
+
if "size" in options:
|
|
63
|
+
size = options["size"].strip()
|
|
64
|
+
return f'<font size="{size}">{value}</font>'
|
|
65
|
+
return value
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def init_default_tags(parser):
|
|
69
|
+
parser.add_simple_formatter("b", "<strong>%(value)s</strong>")
|
|
70
|
+
parser.add_simple_formatter("i", "<em>%(value)s</em>")
|
|
71
|
+
parser.add_simple_formatter("u", "<u>%(value)s</u>")
|
|
72
|
+
parser.add_simple_formatter("s", "<s>%(value)s</s>")
|
|
73
|
+
parser.add_simple_formatter("sub", "<sub>%(value)s</sub>")
|
|
74
|
+
parser.add_simple_formatter("sup", "<sup>%(value)s</sup>")
|
|
75
|
+
parser.add_simple_formatter("escape", "%(value)s", render_embedded=False)
|
|
76
|
+
|
|
77
|
+
parser.add_formatter("font", render_font)
|
|
78
|
+
parser.add_formatter("color", render_color)
|
|
79
|
+
parser.add_formatter("shadow", render_shadow)
|
|
80
|
+
parser.add_formatter("url", render_url, replace_links=False, replace_cosmetic=False)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
_parser = None
|
|
84
|
+
_shoutbox_parser = None
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def get_parser():
|
|
88
|
+
global _parser
|
|
89
|
+
if _parser is None:
|
|
90
|
+
_parser = bbcode.Parser(install_defaults=False)
|
|
91
|
+
init_default_tags(_parser)
|
|
92
|
+
|
|
93
|
+
_parser.add_simple_formatter("hr", "<hr />", standalone=True)
|
|
94
|
+
_parser.add_simple_formatter(
|
|
95
|
+
"center", '<div style="text-align: center">%(value)s</div>'
|
|
96
|
+
)
|
|
97
|
+
_parser.add_simple_formatter(
|
|
98
|
+
"left", '<div style="text-align: left">%(value)s</div>'
|
|
99
|
+
)
|
|
100
|
+
_parser.add_simple_formatter(
|
|
101
|
+
"right", '<div style="text-align: right">%(value)s</div>'
|
|
102
|
+
)
|
|
103
|
+
_parser.add_simple_formatter(
|
|
104
|
+
"ol",
|
|
105
|
+
"<ol>%(value)s</ol>",
|
|
106
|
+
transform_newlines=False,
|
|
107
|
+
strip=True,
|
|
108
|
+
swallow_trailing_newline=True,
|
|
109
|
+
)
|
|
110
|
+
_parser.add_simple_formatter(
|
|
111
|
+
"ul",
|
|
112
|
+
"<ul>%(value)s</ul>",
|
|
113
|
+
transform_newlines=False,
|
|
114
|
+
strip=True,
|
|
115
|
+
swallow_trailing_newline=True,
|
|
116
|
+
)
|
|
117
|
+
_parser.add_simple_formatter(
|
|
118
|
+
"li",
|
|
119
|
+
"<li>%(value)s</li>",
|
|
120
|
+
newline_closes=True,
|
|
121
|
+
transform_newlines=False,
|
|
122
|
+
same_tag_closes=True,
|
|
123
|
+
strip=True,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
_parser.add_formatter("size", render_size)
|
|
127
|
+
_parser.add_formatter(
|
|
128
|
+
"img",
|
|
129
|
+
render_img,
|
|
130
|
+
render_embedded=False,
|
|
131
|
+
replace_links=False,
|
|
132
|
+
replace_cosmetic=False,
|
|
133
|
+
)
|
|
134
|
+
_parser.add_formatter(
|
|
135
|
+
"quote", render_quote, strip=True, swallow_trailing_newline=True
|
|
136
|
+
)
|
|
137
|
+
_parser.add_formatter(
|
|
138
|
+
"code",
|
|
139
|
+
render_code,
|
|
140
|
+
render_embedded=False,
|
|
141
|
+
transform_newlines=False,
|
|
142
|
+
replace_links=False,
|
|
143
|
+
replace_cosmetic=False,
|
|
144
|
+
strip=True,
|
|
145
|
+
swallow_trailing_newline=True,
|
|
146
|
+
)
|
|
147
|
+
return _parser
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def get_shoutbox_parser():
|
|
151
|
+
global _shoutbox_parser
|
|
152
|
+
if _shoutbox_parser is None:
|
|
153
|
+
_shoutbox_parser = bbcode.Parser(install_defaults=False)
|
|
154
|
+
init_default_tags(_shoutbox_parser)
|
|
155
|
+
return _shoutbox_parser
|
punkweb_bb/settings.py
CHANGED
|
@@ -4,7 +4,7 @@ PUNKWEB_BB = getattr(settings, "PUNKWEB_BB", {})
|
|
|
4
4
|
|
|
5
5
|
SITE_NAME = PUNKWEB_BB.get("SITE_NAME", "PUNKWEB")
|
|
6
6
|
SITE_TITLE = PUNKWEB_BB.get("SITE_TITLE", "PunkwebBB")
|
|
7
|
-
|
|
7
|
+
PARSER = PUNKWEB_BB.get("PARSER", "bbcode")
|
|
8
8
|
FAVICON = PUNKWEB_BB.get("FAVICON", "punkweb_bb/favicon.ico")
|
|
9
9
|
OG_IMAGE = PUNKWEB_BB.get("OG_IMAGE", None)
|
|
10
10
|
SHOUTBOX_ENABLED = PUNKWEB_BB.get("SHOUTBOX_ENABLED", True)
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
display: flex;
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
justify-content: center;
|
|
7
|
+
padding: 2rem;
|
|
7
8
|
|
|
8
9
|
position: fixed;
|
|
9
10
|
top: 0;
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
border-radius: 0.25rem;
|
|
29
30
|
box-shadow: 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.25);
|
|
30
31
|
background-color: white;
|
|
32
|
+
overflow: auto;
|
|
31
33
|
position: relative;
|
|
32
34
|
width: fit-content;
|
|
33
35
|
|
|
@@ -181,7 +181,7 @@ blockquote cite {
|
|
|
181
181
|
border-bottom: 1px solid var(--border);
|
|
182
182
|
color: var(--table-header-text);
|
|
183
183
|
font-size: 0.875rem;
|
|
184
|
-
font-weight:
|
|
184
|
+
font-weight: 700;
|
|
185
185
|
padding: 0.75rem 1rem;
|
|
186
186
|
text-align: left;
|
|
187
187
|
}
|
|
@@ -664,7 +664,7 @@ blockquote cite {
|
|
|
664
664
|
.pw-input-label {
|
|
665
665
|
display: block;
|
|
666
666
|
font-size: 0.875rem;
|
|
667
|
-
font-weight:
|
|
667
|
+
font-weight: 700;
|
|
668
668
|
}
|
|
669
669
|
|
|
670
670
|
/** Card **/
|
|
@@ -8,12 +8,16 @@ body {
|
|
|
8
8
|
line-height: 1.5;
|
|
9
9
|
overflow: visible;
|
|
10
10
|
}
|
|
11
|
+
|
|
11
12
|
html {
|
|
12
13
|
height: 100%;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
* {
|
|
16
17
|
box-sizing: border-box;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body {
|
|
17
21
|
margin: 0;
|
|
18
22
|
padding: 0;
|
|
19
23
|
}
|
|
@@ -56,11 +60,6 @@ a {
|
|
|
56
60
|
text-decoration: none;
|
|
57
61
|
}
|
|
58
62
|
|
|
59
|
-
ul,
|
|
60
|
-
ol {
|
|
61
|
-
padding-inline-start: 2rem;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
63
|
code {
|
|
65
64
|
display: block;
|
|
66
65
|
background: #f5f2f0;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
$(function () {
|
|
2
2
|
$(document).ready(function () {
|
|
3
3
|
$(".bbcode-editor").sceditor({
|
|
4
|
-
emoticonsCompat: true,
|
|
5
4
|
emoticonsEnabled: false,
|
|
6
|
-
emoticonsRoot: "/media/precise_bbcode/smilies/",
|
|
7
|
-
emoticons: {
|
|
8
|
-
dropdown: {},
|
|
9
|
-
},
|
|
10
5
|
format: "bbcode",
|
|
11
6
|
icons: "material",
|
|
12
7
|
style: "/static/punkweb_bb/editor/bbcode-editor-content.css",
|
|
@@ -1,21 +1,47 @@
|
|
|
1
|
-
function initMarkdownEditor(
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
function initMarkdownEditor(containerElement) {
|
|
2
|
+
var editorElement = containerElement.querySelector(".markdown-editor");
|
|
3
|
+
var toolbarElement = containerElement.querySelector(
|
|
4
|
+
"#markdown-editor-toolbar"
|
|
5
|
+
);
|
|
5
6
|
|
|
6
|
-
var
|
|
7
|
-
toolbarElement.id = "markdown-editor-toolbar";
|
|
8
|
-
element.parentNode.insertBefore(toolbarElement, element);
|
|
7
|
+
var editor = null;
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
if (!containerElement.querySelector(".TinyMDE")) {
|
|
10
|
+
editor = new TinyMDE.Editor({
|
|
11
|
+
textarea: editorElement,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (editor && !toolbarElement.querySelector(".TMCommandBar")) {
|
|
16
|
+
var toolbar = new TinyMDE.CommandBar({
|
|
17
|
+
element: toolbarElement,
|
|
18
|
+
editor: editor,
|
|
19
|
+
commands: [
|
|
20
|
+
"bold",
|
|
21
|
+
"italic",
|
|
22
|
+
"strikethrough",
|
|
23
|
+
"|",
|
|
24
|
+
"h1",
|
|
25
|
+
"h2",
|
|
26
|
+
"|",
|
|
27
|
+
"ul",
|
|
28
|
+
"ol",
|
|
29
|
+
"|",
|
|
30
|
+
"blockquote",
|
|
31
|
+
"code",
|
|
32
|
+
"insertLink",
|
|
33
|
+
"insertImage",
|
|
34
|
+
"hr",
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
14
38
|
}
|
|
15
39
|
|
|
16
40
|
$(function () {
|
|
17
41
|
$(document).ready(function () {
|
|
18
|
-
var editorElements = document.querySelectorAll(
|
|
42
|
+
var editorElements = document.querySelectorAll(
|
|
43
|
+
".markdown-editor-container"
|
|
44
|
+
);
|
|
19
45
|
editorElements.forEach((element) => {
|
|
20
46
|
initMarkdownEditor(element);
|
|
21
47
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{% extends "punkweb_bb/base.html" %}
|
|
2
|
-
|
|
3
|
-
{% load bbcode_tags %}
|
|
2
|
+
{% load render %}
|
|
4
3
|
|
|
5
4
|
{% block content %}
|
|
6
5
|
|
|
@@ -11,7 +10,7 @@
|
|
|
11
10
|
<div>
|
|
12
11
|
<h4>{{ code.0 }}</h4>
|
|
13
12
|
<pre>{{ code.1 }}</pre>
|
|
14
|
-
{
|
|
13
|
+
{{ code.1|render }}
|
|
15
14
|
</div>
|
|
16
15
|
{% endfor %}
|
|
17
16
|
</div>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{% load
|
|
1
|
+
{% load render styled_username can_delete %}
|
|
2
2
|
|
|
3
3
|
{% for shout in shouts %}
|
|
4
4
|
<div class="shoutbox__shout">
|
|
5
5
|
<div class="shoutbox__shout__content">
|
|
6
6
|
<time datetime="{{shout.created_at|date:'c'}}">{{shout.created_at | date:'g:i A'}}</time>
|
|
7
7
|
<span><a href="{% url 'punkweb_bb:profile' shout.user.id %}">{{shout.user|styled_username}}</a>: </span>
|
|
8
|
-
<span>{{ shout.content|
|
|
8
|
+
<span>{{ shout.content|render_shout }}</span>
|
|
9
9
|
</div>
|
|
10
10
|
{% if shout|can_delete:request.user %}
|
|
11
11
|
<div class="shoutbox__shout__actions">
|
|
Binary file
|
|
Binary file
|
|
@@ -1,48 +1,35 @@
|
|
|
1
1
|
import html
|
|
2
|
-
from io import StringIO
|
|
3
2
|
|
|
4
3
|
import markdown as md
|
|
5
4
|
from django import template
|
|
6
5
|
from django.template.defaultfilters import stringfilter
|
|
7
6
|
from django.utils.safestring import mark_safe
|
|
8
|
-
from precise_bbcode.bbcode import get_parser
|
|
9
7
|
|
|
10
|
-
from punkweb_bb.
|
|
8
|
+
from punkweb_bb.bbcode import get_parser, get_shoutbox_parser
|
|
9
|
+
from punkweb_bb.settings import PARSER
|
|
11
10
|
|
|
12
11
|
register = template.Library()
|
|
13
12
|
|
|
14
13
|
|
|
15
|
-
def unmark_element(element, stream=None):
|
|
16
|
-
if stream is None:
|
|
17
|
-
stream = StringIO()
|
|
18
|
-
if element.text:
|
|
19
|
-
stream.write(element.text)
|
|
20
|
-
for sub in element:
|
|
21
|
-
unmark_element(sub, stream)
|
|
22
|
-
if element.tail:
|
|
23
|
-
stream.write(element.tail)
|
|
24
|
-
return stream.getvalue()
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
md.Markdown.output_formats["plain"] = unmark_element
|
|
28
|
-
unmark = md.Markdown(output_format="plain")
|
|
29
|
-
unmark.stripTopLevelTags = False
|
|
30
|
-
|
|
31
|
-
|
|
32
14
|
@register.filter(is_safe=True)
|
|
33
15
|
@stringfilter
|
|
34
16
|
def render(value):
|
|
35
|
-
if
|
|
17
|
+
if PARSER == "bbcode":
|
|
36
18
|
parser = get_parser()
|
|
37
|
-
rendered = parser.
|
|
38
|
-
|
|
39
|
-
|
|
19
|
+
rendered = parser.format(value)
|
|
20
|
+
return mark_safe(rendered)
|
|
21
|
+
elif PARSER == "markdown":
|
|
22
|
+
escaped = html.escape(value)
|
|
40
23
|
rendered = md.markdown(escaped, extensions=["markdown.extensions.fenced_code"])
|
|
41
|
-
|
|
42
|
-
return
|
|
24
|
+
return mark_safe(rendered)
|
|
25
|
+
return value
|
|
43
26
|
|
|
44
27
|
|
|
45
|
-
@register.filter()
|
|
28
|
+
@register.filter(is_safe=True)
|
|
46
29
|
@stringfilter
|
|
47
|
-
def
|
|
48
|
-
|
|
30
|
+
def render_shout(value):
|
|
31
|
+
if PARSER == "bbcode":
|
|
32
|
+
parser = get_shoutbox_parser()
|
|
33
|
+
rendered = parser.format(value)
|
|
34
|
+
return mark_safe(rendered)
|
|
35
|
+
return value
|
punkweb_bb/utils.py
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
+
from django.forms import Textarea
|
|
1
2
|
from django.utils.text import slugify
|
|
2
|
-
from precise_bbcode.bbcode import get_parser
|
|
3
|
-
from punkweb_bb.settings import RENDERER
|
|
4
3
|
|
|
4
|
+
from punkweb_bb.bbcode import get_parser
|
|
5
|
+
from punkweb_bb.settings import PARSER
|
|
6
|
+
from punkweb_bb.widgets import BBCodeEditorWidget, MarkdownEditorWidget
|
|
5
7
|
|
|
6
|
-
def get_editor_widget():
|
|
7
|
-
if RENDERER == "bbcode":
|
|
8
|
-
from punkweb_bb.widgets import BBCodeEditorWidget
|
|
9
8
|
|
|
9
|
+
def get_editor_widget():
|
|
10
|
+
if PARSER == "bbcode":
|
|
10
11
|
return BBCodeEditorWidget()
|
|
11
|
-
elif
|
|
12
|
-
from punkweb_bb.widgets import MarkdownEditorWidget
|
|
13
|
-
|
|
12
|
+
elif PARSER == "markdown":
|
|
14
13
|
return MarkdownEditorWidget()
|
|
15
|
-
|
|
16
|
-
raise ValueError("Invalid renderer")
|
|
14
|
+
return Textarea(attrs={"class": "pw-input"})
|
|
17
15
|
|
|
18
16
|
|
|
19
17
|
def get_unique_slug(model, field):
|
|
@@ -47,17 +45,17 @@ def get_styled_username(user):
|
|
|
47
45
|
if group:
|
|
48
46
|
parser = get_parser()
|
|
49
47
|
username_style = group.style.username_style
|
|
50
|
-
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
rendered = parser.format(username_style.replace("{USER}", user.username))
|
|
49
|
+
return rendered
|
|
50
|
+
|
|
51
|
+
return user.username
|
|
54
52
|
|
|
55
53
|
|
|
56
54
|
def get_styled_group_name(group):
|
|
57
|
-
if group.style is None:
|
|
58
|
-
return group.name
|
|
59
|
-
else:
|
|
55
|
+
if group.style is not None:
|
|
60
56
|
parser = get_parser()
|
|
61
57
|
username_style = group.style.username_style
|
|
62
|
-
|
|
63
|
-
return
|
|
58
|
+
rendered = parser.format(username_style.replace("{USER}", group.name))
|
|
59
|
+
return rendered
|
|
60
|
+
|
|
61
|
+
return group.name
|
punkweb_bb/views.py
CHANGED
|
@@ -588,16 +588,22 @@ def bbcode_view(request):
|
|
|
588
588
|
("Italic", "[i]Italic Text[/i]"),
|
|
589
589
|
("Underline", "[u]Underlined Text[/u]"),
|
|
590
590
|
("Strikethrough", "[s]Strikethrough Text[/s]"),
|
|
591
|
-
("Quote", "[quote=Example]Quoted Text[/quote]"),
|
|
592
|
-
("Center", "[center]Centered Text[/center]"),
|
|
593
591
|
("Color", "[color=red]Red Text[/color]"),
|
|
592
|
+
("Font", "[font=serif]Serif Text[/font]"),
|
|
593
|
+
("Shadow", "[shadow=red]Red Shadow Text[/shadow]"),
|
|
594
|
+
("Size", "[size=7]Size 7 Text[/size]"),
|
|
595
|
+
("Superscript", "Sup [sup]Superscript Text[/sup]"),
|
|
596
|
+
("Subscript", "Sub [sub]Subscript Text[/sub]"),
|
|
597
|
+
("Horizontal Rule", "[hr]"),
|
|
598
|
+
("Left", "[left]Left Text[/left]"),
|
|
599
|
+
("Center", "[center]Centered Text[/center]"),
|
|
600
|
+
("Right", "[right]Right Text[/right]"),
|
|
601
|
+
("Quote", "[quote=Example]Quoted Text[/quote]"),
|
|
594
602
|
("Url", "[url=https://google.com]Link Text[/url]"),
|
|
595
603
|
(
|
|
596
604
|
"Image",
|
|
597
605
|
"[img]https://placehold.co/400[/img]",
|
|
598
606
|
),
|
|
599
|
-
# Custom
|
|
600
|
-
("Horizontal Rule", "[hr]"),
|
|
601
607
|
(
|
|
602
608
|
"Code",
|
|
603
609
|
"""
|
|
@@ -616,23 +622,8 @@ class ThreadModelForm(forms.ModelForm):
|
|
|
616
622
|
[/code]
|
|
617
623
|
""",
|
|
618
624
|
),
|
|
619
|
-
("Email", "[email=test@example.com]Example[/email]"),
|
|
620
|
-
("Font", "[font=serif]Serif Text[/font]"),
|
|
621
625
|
("Ordered List", "[ol][li]Item 1[/li][li]Item 2[/li][/ol]"),
|
|
622
626
|
("Unordered List", "[ul][li]Item 1[/li][li]Item 2[/li][/ul]"),
|
|
623
|
-
("Shadow", "[shadow=red]Red Shadow Text[/shadow]"),
|
|
624
|
-
("Size", "[size=7]Size 7 Text[/size]"),
|
|
625
|
-
(
|
|
626
|
-
"Checkbox",
|
|
627
|
-
"""
|
|
628
|
-
[n]Unchecked
|
|
629
|
-
[y]Checked
|
|
630
|
-
""",
|
|
631
|
-
),
|
|
632
|
-
("Superscript", "Sup [sup]Superscript Text[/sup]"),
|
|
633
|
-
("Subscript", "Sub [sub]Subscript Text[/sub]"),
|
|
634
|
-
("Left", "[left]Left Text[/left]"),
|
|
635
|
-
("Right", "[right]Right Text[/right]"),
|
|
636
627
|
("Escape", "[escape][b]Escaped bbcode[/b][/escape]"),
|
|
637
628
|
)
|
|
638
629
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: punkweb-bb
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Django application that provides a simple and modern forum board software for your Django website.
|
|
5
5
|
Home-page: https://github.com/Punkweb/PunkwebBB
|
|
6
6
|
Author: Punkweb
|
|
@@ -16,26 +16,24 @@ Classifier: Programming Language :: Python :: 3
|
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: django >=4.0
|
|
19
|
-
Requires-Dist:
|
|
19
|
+
Requires-Dist: bbcode
|
|
20
20
|
Requires-Dist: markdown
|
|
21
|
-
Requires-Dist: expiringdict
|
|
22
21
|
Requires-Dist: pillow
|
|
22
|
+
Requires-Dist: expiringdict
|
|
23
23
|
|
|
24
24
|
# PunkwebBB
|
|
25
25
|
|
|
26
26
|
PunkwebBB is a Django application that provides a simple and modern forum board software for your Django website.
|
|
27
27
|
|
|
28
|
-
This is the successor to [punkweb-boards](https://github.com/Punkweb/punkweb-boards).
|
|
29
|
-
|
|
30
28
|
Check out [punkweb.net](https://punkweb.net/board/) for documentation, support and a live demonstration of the software.
|
|
31
29
|
|
|
32
30
|
## Built with
|
|
33
31
|
|
|
34
32
|
- [Django](https://www.djangoproject.com/)
|
|
35
|
-
- [django-precise-bbcode](https://github.com/ellmetha/django-precise-bbcode)
|
|
36
|
-
- [Markdown](https://python-markdown.github.io/)
|
|
37
33
|
- [HTMX](https://htmx.org/)
|
|
38
34
|
- [jQuery](https://jquery.com/)
|
|
35
|
+
- [bbcode](https://pypi.org/project/bbcode/)
|
|
36
|
+
- [Markdown](https://pypi.org/project/Markdown/)
|
|
39
37
|
- [SCEditor](https://www.sceditor.com/)
|
|
40
38
|
- [TinyMDE](https://github.com/jefago/tiny-markdown-editor)
|
|
41
39
|
- [PrismJS](https://prismjs.com/)
|
|
@@ -44,21 +42,18 @@ Check out [punkweb.net](https://punkweb.net/board/) for documentation, support a
|
|
|
44
42
|
|
|
45
43
|
- Python 3.9+
|
|
46
44
|
- Django 4.0+
|
|
47
|
-
- django-precise-bbcode 1.2+
|
|
48
|
-
- markdown 3.6+
|
|
49
|
-
- Pillow
|
|
50
45
|
|
|
51
46
|
It may work with older versions of Python and Django, but it has not been tested.
|
|
52
47
|
|
|
53
48
|
## BBCode or Markdown?
|
|
54
49
|
|
|
55
|
-
PunkwebBB supports both BBCode and Markdown. You'll want to decide before installing which
|
|
50
|
+
PunkwebBB supports both BBCode and Markdown. You'll want to decide before installing which parser you want to use, as switching between them will cause existing threads, posts, signatures, etc. to render incorrectly! Switching will not affect the database schema, but it will affect the content.
|
|
56
51
|
|
|
57
|
-
BBCode is the default
|
|
52
|
+
BBCode is the default parser, but you can switch to Markdown by setting the following in your Django settings module:
|
|
58
53
|
|
|
59
54
|
```python
|
|
60
55
|
PUNKWEB_BB = {
|
|
61
|
-
"
|
|
56
|
+
"PARSER": "markdown",
|
|
62
57
|
}
|
|
63
58
|
```
|
|
64
59
|
|
|
@@ -68,18 +63,15 @@ PUNKWEB_BB = {
|
|
|
68
63
|
pip install punkweb-bb
|
|
69
64
|
```
|
|
70
65
|
|
|
71
|
-
Add `
|
|
66
|
+
Add `punkweb_bb` to your `INSTALLED_APPS` in your Django settings module:
|
|
72
67
|
|
|
73
68
|
```python
|
|
74
69
|
INSTALLED_APPS = [
|
|
75
70
|
...
|
|
76
|
-
"precise_bbcode",
|
|
77
71
|
"punkweb_bb",
|
|
78
72
|
]
|
|
79
73
|
```
|
|
80
74
|
|
|
81
|
-
_Note_: `precise_bbcode` is required even if using the Markdown renderer! It must be installed before `punkweb_bb`.
|
|
82
|
-
|
|
83
75
|
Add the following context processor to your `TEMPLATES` setting:
|
|
84
76
|
|
|
85
77
|
```python
|
|
@@ -121,7 +113,7 @@ These are the default settings for PunkwebBB, which can be overridden in your Dj
|
|
|
121
113
|
PUNKWEB_BB = {
|
|
122
114
|
"SITE_NAME": "PUNKWEB",
|
|
123
115
|
"SITE_TITLE": "PunkwebBB",
|
|
124
|
-
"
|
|
116
|
+
"PARSER": "bbcode", # "bbcode" or "markdown"
|
|
125
117
|
"FAVICON": "punkweb_bb/favicon.ico",
|
|
126
118
|
"OG_IMAGE": None, # Used for Open Graph meta tags, must be a full URL!
|
|
127
119
|
"SHOUTBOX_ENABLED": True,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
punkweb_bb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
punkweb_bb/admin.py,sha256=
|
|
2
|
+
punkweb_bb/admin.py,sha256=W8f91MenKxds6RUOxL0OkXuoHTGL76zZ-nqZEATPONU,2640
|
|
3
3
|
punkweb_bb/admin_forms.py,sha256=nvHKaqJx6rJv5G8yzaDcWYU9gsytg9gMJkz79v8bdUc,1414
|
|
4
4
|
punkweb_bb/apps.py,sha256=GCDLy9B9vumeCsaauQ7LN4FOqE02mXWXECIz8G6KZCQ,207
|
|
5
|
-
punkweb_bb/
|
|
5
|
+
punkweb_bb/bbcode.py,sha256=AH8x-X4xst0S8Xlyiv18X_RuPAyCGGHEm4H4ChccjM8,4983
|
|
6
6
|
punkweb_bb/context_processors.py,sha256=BEOGvWVukvxJUxWZBIc32ioB-mGqImSEBuhhZjqI2G0,146
|
|
7
7
|
punkweb_bb/forms.py,sha256=jFW7VDV2tAuHymt_3F20TyWXNq_3ZJ-_KQdeZOk2Sbo,3130
|
|
8
8
|
punkweb_bb/guests.py,sha256=Nvn4ZVJvQSQs_f-GeSwNn79Qp8ap_CAoXpYfRTqSbxg,467
|
|
@@ -10,37 +10,38 @@ punkweb_bb/middleware.py,sha256=NrYv6nyAYKGcu-qKRnZmCyLghtJ4MUHvt3m5NS8HJbo,628
|
|
|
10
10
|
punkweb_bb/mixins.py,sha256=XfiThPL7rB71IfukS1ikvYQhfg8RwgSVgsm10Ul1ezM,395
|
|
11
11
|
punkweb_bb/models.py,sha256=G0He7JFT6uNQ6Gxy5CRdlfX3G2c3pv0LM67_HZf-DAc,7053
|
|
12
12
|
punkweb_bb/pagination.py,sha256=OgoZuJsq9MKMvBKYylJVPaNtM9ni3K8OAvOdi-eGr3M,409
|
|
13
|
-
punkweb_bb/parsers.py,sha256=VjWSPqpVfypHLHP0NrfLqXB-1b0W6oFuGIzoAiPi71I,2732
|
|
14
13
|
punkweb_bb/response.py,sha256=dETGVC9Xrsq02pQzmIIWbSUt472lJ4fgLwBKrXnP3t4,130
|
|
15
|
-
punkweb_bb/settings.py,sha256=
|
|
14
|
+
punkweb_bb/settings.py,sha256=7ySSAgNiefcdNWtGBPhMh2V8FVnrY7cpdeVIZ5Om7NM,605
|
|
16
15
|
punkweb_bb/signals.py,sha256=bVdfg942Mwq-fYDZ1Z52Q0V2BCk1lgzGz8JVZFPnzJ8,365
|
|
17
16
|
punkweb_bb/tests.py,sha256=puvvh789RvK5UxPzol7dFmQPU1dfGPjzjuQ5vka6oT0,26298
|
|
18
17
|
punkweb_bb/urls.py,sha256=AkTP3VTb6mr0eQU2Wr7C4ZEKvrRDj9mRUFveWOgdE28,2673
|
|
19
|
-
punkweb_bb/utils.py,sha256=
|
|
20
|
-
punkweb_bb/views.py,sha256=
|
|
18
|
+
punkweb_bb/utils.py,sha256=qxfs8sgWVI55MbAiwfuZ-Ln-v3hRGj_4XhpMbjNCnH0,1568
|
|
19
|
+
punkweb_bb/views.py,sha256=hVys3rHUswD9NS4hL-RN3gIo2SnqY52NKyEoiC2lhOw,18010
|
|
21
20
|
punkweb_bb/widgets.py,sha256=uIkXnIvYLNncWWyQV069Y2YgeB1m_YG8r5y2ztkdrO8,1502
|
|
22
21
|
punkweb_bb/__pycache__/__init__.cpython-311.pyc,sha256=3PyxCxoznfadaGt0a7re4j0Ky9z9hblufpcwPB85kK8,161
|
|
23
|
-
punkweb_bb/__pycache__/admin.cpython-311.pyc,sha256=
|
|
24
|
-
punkweb_bb/__pycache__/admin_forms.cpython-311.pyc,sha256=
|
|
22
|
+
punkweb_bb/__pycache__/admin.cpython-311.pyc,sha256=dNdyvl0j28dlAhcN7nE1KezjP4786itp9rQ3Jq_mooc,3810
|
|
23
|
+
punkweb_bb/__pycache__/admin_forms.cpython-311.pyc,sha256=ggTP4ngqAlyR1z91zjxh2s5AwzcmRV1EtxTuttZ5aq4,3605
|
|
25
24
|
punkweb_bb/__pycache__/apps.cpython-311.pyc,sha256=lw328DOwOp1F8FWTFYb3qV1EoBNgRr_Tc4J8DXfIl-I,730
|
|
25
|
+
punkweb_bb/__pycache__/bbcode.cpython-311.pyc,sha256=dwVCqvevfi93vv5ROEniMOpcrxjPOnhvsCDnox1gbEQ,6638
|
|
26
26
|
punkweb_bb/__pycache__/bbcode_tags.cpython-311.pyc,sha256=QI4BJt5plqLMiAvlVAxibuNONi69PJFQpotpS50olro,8534
|
|
27
27
|
punkweb_bb/__pycache__/context_processors.cpython-311.pyc,sha256=P7rEsodXonYexbS5vUaUKVJ9tIx1pOVk6NQWVvWNvS8,392
|
|
28
|
-
punkweb_bb/__pycache__/forms.cpython-311.pyc,sha256=
|
|
28
|
+
punkweb_bb/__pycache__/forms.cpython-311.pyc,sha256=GYifujT3WNioRq9FBFyhNpVpOOYIUJC2u9o4CFidfk8,6735
|
|
29
29
|
punkweb_bb/__pycache__/guests.cpython-311.pyc,sha256=vgZJcZGyHZkllCAhXHGgajHh7YM1ntXinSed3ojIK6I,1581
|
|
30
|
-
punkweb_bb/__pycache__/middleware.cpython-311.pyc,sha256=
|
|
31
|
-
punkweb_bb/__pycache__/mixins.cpython-311.pyc,sha256=
|
|
32
|
-
punkweb_bb/__pycache__/models.cpython-311.pyc,sha256=
|
|
33
|
-
punkweb_bb/__pycache__/pagination.cpython-311.pyc,sha256=
|
|
34
|
-
punkweb_bb/__pycache__/parsers.cpython-311.pyc,sha256=
|
|
35
|
-
punkweb_bb/__pycache__/response.cpython-311.pyc,sha256=
|
|
36
|
-
punkweb_bb/__pycache__/settings.cpython-311.pyc,sha256=
|
|
37
|
-
punkweb_bb/__pycache__/signals.cpython-311.pyc,sha256=
|
|
30
|
+
punkweb_bb/__pycache__/middleware.cpython-311.pyc,sha256=QXa_vFXK6miVQqHTb-HFNS62yLu90O2yGTxR-ukGZ10,1560
|
|
31
|
+
punkweb_bb/__pycache__/mixins.cpython-311.pyc,sha256=BS1LyR5D-Cpw9_foyhW56vRRcNles0bu7Hv3dgWtAK0,1478
|
|
32
|
+
punkweb_bb/__pycache__/models.cpython-311.pyc,sha256=EwRbKrTe3GAvIDbGiNK2Us1CJR-8nJhvS35Tu7bb8U8,15480
|
|
33
|
+
punkweb_bb/__pycache__/pagination.cpython-311.pyc,sha256=l44YUnzwgmYAxVWgQ3JaDFIU2gPRhEsKuJ0ywt0u45w,990
|
|
34
|
+
punkweb_bb/__pycache__/parsers.cpython-311.pyc,sha256=NVAKGs5OFYJ06g7oOuWjW-qObXXZ0hXXJbZ-Zycx12A,160
|
|
35
|
+
punkweb_bb/__pycache__/response.cpython-311.pyc,sha256=GK2hK5sACmvmilazV7n_9JAsCzabOSi98gcsreAeDSY,448
|
|
36
|
+
punkweb_bb/__pycache__/settings.cpython-311.pyc,sha256=kjeJ45pZAQq_Ecb_G3glA1CYnNOhZeHPjh3eFD8Xf1Y,1109
|
|
37
|
+
punkweb_bb/__pycache__/signals.cpython-311.pyc,sha256=V56nLY2a1WTBfvJ7GD2MBXZx9PuxtQoTREwRMggZrEA,864
|
|
38
38
|
punkweb_bb/__pycache__/sitemap.cpython-311.pyc,sha256=GFjuUD20_ikJWj7IFT1Cn7Od-rw2tsQ45tVMolyTWzA,1591
|
|
39
|
-
punkweb_bb/__pycache__/
|
|
40
|
-
punkweb_bb/__pycache__/
|
|
41
|
-
punkweb_bb/__pycache__/
|
|
42
|
-
punkweb_bb/__pycache__/
|
|
43
|
-
punkweb_bb/__pycache__/
|
|
39
|
+
punkweb_bb/__pycache__/tags.cpython-311.pyc,sha256=nr_Va9Nz8H6kUjxx8mDJi3D4gGo31K92BZKRXHgBFuw,1052
|
|
40
|
+
punkweb_bb/__pycache__/tests.cpython-311.pyc,sha256=5PSZQVuRWikAHkjKPxn69XWLSHO5PXxzmzSWqG0dOPQ,51701
|
|
41
|
+
punkweb_bb/__pycache__/urls.cpython-311.pyc,sha256=enGd9gcLCxN77wcy6a7v_WCTut0OWwURscNptONTzPk,3686
|
|
42
|
+
punkweb_bb/__pycache__/utils.cpython-311.pyc,sha256=zFY5S4BmYPoiWMVrvaxsvtuabYVjz7cPMZQ4PpKvD0s,2823
|
|
43
|
+
punkweb_bb/__pycache__/views.cpython-311.pyc,sha256=aA95XS49Ab4c8R6ia_JUqELT03QNsRh-ftkMMLpQVv8,26263
|
|
44
|
+
punkweb_bb/__pycache__/widgets.cpython-311.pyc,sha256=gqOCVpoOMIpedui0OQX7kMUnY4Vs2wFt3TLbtUWvkzY,2640
|
|
44
45
|
punkweb_bb/migrations/0001_initial.py,sha256=3RGsylygBcWx1kIPhSzOb9v_2yvowsxKfxuSinKKuS0,8950
|
|
45
46
|
punkweb_bb/migrations/0002_thread_view_count.py,sha256=JJZT53Mp8Ofht3oIi67s-0wzCdpYyu8wOeCi_B8q8Yo,388
|
|
46
47
|
punkweb_bb/migrations/0003_alter_thread_options.py,sha256=0xwVfSMWs28akDMhMwOdyyuC7JZ47JekkphT8fUCpcA,589
|
|
@@ -57,27 +58,27 @@ punkweb_bb/migrations/__pycache__/0006_remove_boardprofile__signature_rendered_a
|
|
|
57
58
|
punkweb_bb/migrations/__pycache__/__init__.cpython-311.pyc,sha256=sTbC1AXnh0V4BJwjcjs1ckdeYjG01I348hZwLE2HI4Y,172
|
|
58
59
|
punkweb_bb/static/punkweb_bb/favicon.ico,sha256=lEfX--R9wEGPkkXgLYCsGmHuAGajigiqBXAoonxq8ZM,318
|
|
59
60
|
punkweb_bb/static/punkweb_bb/css/category-form.css,sha256=lvG7Lh2GGBVplKk46JAIHF1cmFLve2JT32BswmudIF8,359
|
|
60
|
-
punkweb_bb/static/punkweb_bb/css/defaults.css,sha256=
|
|
61
|
+
punkweb_bb/static/punkweb_bb/css/defaults.css,sha256=VFV8GzZc6esWa8O7yQNcFjxPGhDfxpI-W3GEgbiaqXQ,1455
|
|
61
62
|
punkweb_bb/static/punkweb_bb/css/index.css,sha256=Jr4P0uLQ0lhM1ujycNVYYnu6tFmFXVZUXMJxFzes-Bo,1415
|
|
62
63
|
punkweb_bb/static/punkweb_bb/css/login.css,sha256=pt5ul4ycZsVB-No3c5gsQa1zVS1iAZgteN1CcllS26k,234
|
|
63
64
|
punkweb_bb/static/punkweb_bb/css/members.css,sha256=1Fz0uVDbs3RnuXNjOtnGnK2jok3LEQBoPhjRYp7gNwE,395
|
|
64
65
|
punkweb_bb/static/punkweb_bb/css/post-form.css,sha256=rEiYplAobLjjUYAcnjNqIjyIVhe9O5hAlPJ3STW-K14,321
|
|
65
66
|
punkweb_bb/static/punkweb_bb/css/profile.css,sha256=yfNJT_D-05deqiBrdIgPeCSO_DFSL8-fGEEHnGrCIYM,916
|
|
66
|
-
punkweb_bb/static/punkweb_bb/css/punkweb-modal.css,sha256=
|
|
67
|
-
punkweb_bb/static/punkweb_bb/css/punkweb.css,sha256=
|
|
67
|
+
punkweb_bb/static/punkweb_bb/css/punkweb-modal.css,sha256=5iT8bVOmC2fhgx1YCgD6IOvUiWTT1LXV0bo_FU2MEzE,1331
|
|
68
|
+
punkweb_bb/static/punkweb_bb/css/punkweb.css,sha256=Rtkz917V0ZjI9vIslBVesyexwi1WYQW92BuoVqbIBJ4,14557
|
|
68
69
|
punkweb_bb/static/punkweb_bb/css/settings.css,sha256=ulQQFTu8slk2rYOmhvci5v-AVnguUuDhKQDhyQOsQNU,308
|
|
69
70
|
punkweb_bb/static/punkweb_bb/css/shoutbox.css,sha256=DapBIe21b6w7ugA_U1EJ-1LFb3IfnJZMw7Kc4DLxF1g,536
|
|
70
71
|
punkweb_bb/static/punkweb_bb/css/subcategory-form.css,sha256=KU-fI8-DiurYiiBVeNk-9vERekbJrOTxllPPFYXu5Fk,371
|
|
71
|
-
punkweb_bb/static/punkweb_bb/css/subcategory.css,sha256=
|
|
72
|
+
punkweb_bb/static/punkweb_bb/css/subcategory.css,sha256=Um-L-9sqK_8r6zUHeQFlNLCskIKfjgj_mpfQVE5NQwU,783
|
|
72
73
|
punkweb_bb/static/punkweb_bb/css/thread-form.css,sha256=9MfqocnamNMjeNJ-w6YTwYbm4oepeK09phFzVsg1XO8,329
|
|
73
74
|
punkweb_bb/static/punkweb_bb/css/thread.css,sha256=1E7FPNCmvLyOC6xSYmslVho6vde3-t1ex_Hz8GA1k6s,2032
|
|
74
75
|
punkweb_bb/static/punkweb_bb/css/typography.css,sha256=qbFGBcU-OOe7r41xeW0Gc_9x6yHxhh81XtswmFxgavc,448
|
|
75
76
|
punkweb_bb/static/punkweb_bb/css/variables.css,sha256=WphZPeJgeqMYy4JYaSTX0gX-JiZh8EJlhieGOGk75DA,1193
|
|
76
|
-
punkweb_bb/static/punkweb_bb/editor/bbcode-editor-content.css,sha256=
|
|
77
|
+
punkweb_bb/static/punkweb_bb/editor/bbcode-editor-content.css,sha256=qAjglfH5ePgwlY0an6eC8yvasjKpCjf0KUoeCNg2aZg,1435
|
|
77
78
|
punkweb_bb/static/punkweb_bb/editor/bbcode-editor-tags.js,sha256=pLgF7lIJnPQXpfqQnkTHBU5tjcvICDHpn2nhvzxwUqA,1624
|
|
78
79
|
punkweb_bb/static/punkweb_bb/editor/bbcode-editor.css,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
79
|
-
punkweb_bb/static/punkweb_bb/editor/bbcode-editor.js,sha256=
|
|
80
|
-
punkweb_bb/static/punkweb_bb/editor/markdown-editor.js,sha256=
|
|
80
|
+
punkweb_bb/static/punkweb_bb/editor/bbcode-editor.js,sha256=_8McMObUj-Uj37awYk7dc4IQGfGCVYvhfdSFzwohRQU,473
|
|
81
|
+
punkweb_bb/static/punkweb_bb/editor/markdown-editor.js,sha256=qLE-6IiPcasxHLP_k7zZP2P8V3wmEA7hZ1GZWeh3Xig,1061
|
|
81
82
|
punkweb_bb/static/punkweb_bb/img/default-profile-image.png,sha256=plGHkG9uiCmgof9Hcv7YNT0oThtDIhJtMzjbxxTtdFY,60475
|
|
82
83
|
punkweb_bb/static/punkweb_bb/js/punkweb-modal.js,sha256=by7e5bpdC-KJ9HT6LqAu8c868CvI5vans4S70DuAmrs,179
|
|
83
84
|
punkweb_bb/static/punkweb_bb/js/shoutbox.js,sha256=dgWq_6yzcwj9uWtvluTJeWa3bVmgtPJke48KbzL7Q1s,142
|
|
@@ -262,7 +263,7 @@ punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/ul.svg,sha256=3
|
|
|
262
263
|
punkweb_bb/templates/punkweb_bb/base.html,sha256=-swjri5cx547vuLVApepf8AchoAVrK2TjwtV7lmxdZc,4426
|
|
263
264
|
punkweb_bb/templates/punkweb_bb/base_delete_modal.html,sha256=Od6qBPgnY9-6JvUHAlsXcEbXzo39qc5YC-omfaN7Nnk,422
|
|
264
265
|
punkweb_bb/templates/punkweb_bb/base_modal.html,sha256=OCbtsMWeNCO0Tl1PmHCcGkwoi1OZjeIK_VhNTzMor7M,460
|
|
265
|
-
punkweb_bb/templates/punkweb_bb/bbcode.html,sha256=
|
|
266
|
+
punkweb_bb/templates/punkweb_bb/bbcode.html,sha256=r65rMEAtbB4TXDBD9wIht8w8kqNxetMsNNGR5hY62QQ,390
|
|
266
267
|
punkweb_bb/templates/punkweb_bb/category_create.html,sha256=773uJzxVvuPmWVrW87EoQTBNoo6cyi3UBp_PZn6JY5A,1369
|
|
267
268
|
punkweb_bb/templates/punkweb_bb/category_update.html,sha256=GUFo19BXY8JVvxP7cWAyWiTD5Z9LohR4f6vf1jlRqfo,1467
|
|
268
269
|
punkweb_bb/templates/punkweb_bb/index.html,sha256=p2Lzw8DhjawebN0iGaDvMQPFZupOCebGwvBv5uXltEk,10519
|
|
@@ -284,16 +285,15 @@ punkweb_bb/templates/punkweb_bb/partials/shout_delete.html,sha256=dH0kkabuLe4gdK
|
|
|
284
285
|
punkweb_bb/templates/punkweb_bb/partials/subcategory_delete.html,sha256=Rzzt_lrrXe7xKI1Xd75OGg6YKUbfEUYBMiwIdEZOqLI,246
|
|
285
286
|
punkweb_bb/templates/punkweb_bb/partials/thread_delete.html,sha256=Ig4Ck0WiysHfK5CdS7XnQzRNn85nmYLiDSSJeUXXd3c,224
|
|
286
287
|
punkweb_bb/templates/punkweb_bb/partials/thread_move.html,sha256=sJu5kKvNztzTSJwBDEHHY2bMW67ZYh__AJE-WbmgZWg,746
|
|
287
|
-
punkweb_bb/templates/punkweb_bb/shoutbox/shout_list.html,sha256=
|
|
288
|
+
punkweb_bb/templates/punkweb_bb/shoutbox/shout_list.html,sha256=mN7Ob4-uDnq4kGjTacOCB6HKa4R2I0xa1fx6UpAugsQ,781
|
|
288
289
|
punkweb_bb/templates/punkweb_bb/shoutbox/shoutbox.html,sha256=J_Lp6KKcqSJr-IayyLN-p0JgMfuwbFP77g-UtcM53WI,672
|
|
289
|
-
punkweb_bb/templates/punkweb_bb/widgets/markdown-editor.html,sha256=
|
|
290
|
+
punkweb_bb/templates/punkweb_bb/widgets/markdown-editor.html,sha256=CmOIl6vv5qyFsajMOB5cSfr09mGhGWeXNsY4hGXRvnM,142
|
|
290
291
|
punkweb_bb/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
291
292
|
punkweb_bb/templatetags/can_delete.py,sha256=NiFi_VH3KKaAYxdu9cZXR9gT9SNEeLAxnbxb4R7O_Nw,137
|
|
292
293
|
punkweb_bb/templatetags/can_edit.py,sha256=CbnbCcmJkeHZbWbsMn5OmCXMBEa6N1KW6W1dHLQvdWM,133
|
|
293
294
|
punkweb_bb/templatetags/can_post.py,sha256=6J1ojqqyNX99DBZM30jQiirQxAyY5rMi05QXXQjJB7I,133
|
|
294
295
|
punkweb_bb/templatetags/humanize_int.py,sha256=C4KmDG0Jv6o8rwT1RXLdWoGLddJxMxgOoRV9I2598AM,248
|
|
295
|
-
punkweb_bb/templatetags/render.py,sha256=
|
|
296
|
-
punkweb_bb/templatetags/shoutbox_render.py,sha256=GVuqifMY0Y-TAb-6L3TLNQ9KjFxVO7gyTnhIZVHIgYI,591
|
|
296
|
+
punkweb_bb/templatetags/render.py,sha256=w6gjmYNPpehOStplH_iSHD_t7ZWwN-QabSNCekAE3sg,934
|
|
297
297
|
punkweb_bb/templatetags/styled_group_name.py,sha256=ybg2SnrXg8nyfZBZOW4L_IV-BlTPrs3EKZ48GsKd-3A,257
|
|
298
298
|
punkweb_bb/templatetags/styled_username.py,sha256=1bv6_ss8elDtuJosAYBlKagUciUXb_WlA5X8O4mKtLI,202
|
|
299
299
|
punkweb_bb/templatetags/__pycache__/__init__.cpython-311.pyc,sha256=VEPKwaIhqpKpSSJiotDYngAUdidDzR9PpPiHtKEl1jA,174
|
|
@@ -303,14 +303,14 @@ punkweb_bb/templatetags/__pycache__/can_post.cpython-311.pyc,sha256=1IU4-Ar-kwjn
|
|
|
303
303
|
punkweb_bb/templatetags/__pycache__/humanize_count.cpython-311.pyc,sha256=UKD6_5RX8YpYpg-LPrgGxBkW56THsbYY51cKTYdKwRY,621
|
|
304
304
|
punkweb_bb/templatetags/__pycache__/humanize_int.cpython-311.pyc,sha256=csY5ek-bevYVeM91hYFKozuKWXCTXb7M-7Bokwdxhrk,619
|
|
305
305
|
punkweb_bb/templatetags/__pycache__/markdown.cpython-311.pyc,sha256=gVou8LgnZCf7b5_D52rimaEICsav98nb1YJic10nQyA,1858
|
|
306
|
-
punkweb_bb/templatetags/__pycache__/render.cpython-311.pyc,sha256=
|
|
306
|
+
punkweb_bb/templatetags/__pycache__/render.cpython-311.pyc,sha256=WXmmYwfTuamjY1vjvdgR4xiX8CrJtswDZcu3FNv13lw,1880
|
|
307
307
|
punkweb_bb/templatetags/__pycache__/shoutbox_bbcode.cpython-311.pyc,sha256=h5Md024xXjG3N574GjQWR8u4c8UsCsiBWP_usQiJUdE,945
|
|
308
|
-
punkweb_bb/templatetags/__pycache__/shoutbox_render.cpython-311.pyc,sha256=
|
|
308
|
+
punkweb_bb/templatetags/__pycache__/shoutbox_render.cpython-311.pyc,sha256=FT-Y3-st8ZLrLNiWWlR308lMi7bmu57YyBpdmF_JEKQ,810
|
|
309
309
|
punkweb_bb/templatetags/__pycache__/styled_group_name.cpython-311.pyc,sha256=1rXkWaqTzivl0uvVs-UiPHOfvx7rOO4Kce6Elhoer_I,712
|
|
310
310
|
punkweb_bb/templatetags/__pycache__/styled_username.cpython-311.pyc,sha256=a91ogyUeLdHS9rEU28FWEYeVqcJopjbvPPdnGkmlHKI,628
|
|
311
311
|
punkweb_bb/templatetags/__pycache__/username.cpython-311.pyc,sha256=GvZkwtrFvkRr1RbxoejyKMmJXr01ABz3lVEwPNq4wxk,626
|
|
312
|
-
punkweb_bb-0.
|
|
313
|
-
punkweb_bb-0.
|
|
314
|
-
punkweb_bb-0.
|
|
315
|
-
punkweb_bb-0.
|
|
316
|
-
punkweb_bb-0.
|
|
312
|
+
punkweb_bb-0.4.0.dist-info/LICENSE,sha256=YYysF07B-kyXSO7IWFB9f49ZXa6LIFUTVsR1Ogmhp8s,1507
|
|
313
|
+
punkweb_bb-0.4.0.dist-info/METADATA,sha256=pOPiFRomB8wB96-CztlBxY7jzbip2LFmIRbSZiMIxzU,5955
|
|
314
|
+
punkweb_bb-0.4.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
315
|
+
punkweb_bb-0.4.0.dist-info/top_level.txt,sha256=sWuGdGnk0ejOXiFDzlBqrNs2VbPEx0_i8UwWXn4SuHU,11
|
|
316
|
+
punkweb_bb-0.4.0.dist-info/RECORD,,
|
punkweb_bb/bbcode_tags.py
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
from precise_bbcode.bbcode.tag import BBCodeTag
|
|
2
|
-
from precise_bbcode.tag_pool import tag_pool
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class CheckedBoxBBCodeTag(BBCodeTag):
|
|
6
|
-
name = "y"
|
|
7
|
-
definition_string = "[y]{TEXT}"
|
|
8
|
-
format_string = """<label style="display: block"><input type="checkbox" disabled="disabled" checked="checked" /> {TEXT}</label>"""
|
|
9
|
-
|
|
10
|
-
class Options:
|
|
11
|
-
newline_closes = True
|
|
12
|
-
same_tag_closes = True
|
|
13
|
-
end_tag_closes = True
|
|
14
|
-
strip = True
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class CodeBBCodeTag(BBCodeTag):
|
|
18
|
-
name = "code"
|
|
19
|
-
|
|
20
|
-
class Options:
|
|
21
|
-
render_embedded = False
|
|
22
|
-
strip = True
|
|
23
|
-
transform_newlines = False
|
|
24
|
-
|
|
25
|
-
def render(self, value, option=None, parent=None):
|
|
26
|
-
if option is not None:
|
|
27
|
-
return f"<pre><code class='language-{option}'>{value}</code></pre>"
|
|
28
|
-
return f"<pre><code>{value}</code></pre>"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class EmailBBCodeTag(BBCodeTag):
|
|
32
|
-
name = "email"
|
|
33
|
-
definition_string = "[email={TEXT1}]{TEXT2}[/email]"
|
|
34
|
-
format_string = """<a href="mailto:{TEXT1}">{TEXT2}</a>"""
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class EscapeBBCodeTag(BBCodeTag):
|
|
38
|
-
name = "escape"
|
|
39
|
-
definition_string = "[escape]{TEXT}[/escape]"
|
|
40
|
-
format_string = """<div class="escaped">{TEXT}</div>"""
|
|
41
|
-
|
|
42
|
-
class Options:
|
|
43
|
-
render_embedded = False
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class FontBBCodeTag(BBCodeTag):
|
|
47
|
-
name = "font"
|
|
48
|
-
definition_string = "[font={TEXT1}]{TEXT2}[/font]"
|
|
49
|
-
format_string = '<span style="font-family:{TEXT1}">{TEXT2}</span>'
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class HrBBCodeTag(BBCodeTag):
|
|
53
|
-
name = "hr"
|
|
54
|
-
definition_string = "[hr]"
|
|
55
|
-
format_string = "<hr/>"
|
|
56
|
-
|
|
57
|
-
class Options:
|
|
58
|
-
standalone = True
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
class LeftBBCodeTag(BBCodeTag):
|
|
62
|
-
name = "left"
|
|
63
|
-
definition_string = "[left]{TEXT}[/left]"
|
|
64
|
-
format_string = """<div style="text-align: left">{TEXT}</div>"""
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class LiBBCodeTag(BBCodeTag):
|
|
68
|
-
name = "li"
|
|
69
|
-
definition_string = "[li]{TEXT}[/li]"
|
|
70
|
-
format_string = "<li>{TEXT}</li>"
|
|
71
|
-
|
|
72
|
-
class Options:
|
|
73
|
-
strip = True
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
class OlBBCodeTag(BBCodeTag):
|
|
77
|
-
name = "ol"
|
|
78
|
-
definition_string = "[ol]{TEXT}[/ol]"
|
|
79
|
-
format_string = "<ol>{TEXT}</ol>"
|
|
80
|
-
|
|
81
|
-
class Options:
|
|
82
|
-
transform_newlines = False
|
|
83
|
-
strip = True
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
class QuoteBBCodeTag(BBCodeTag):
|
|
87
|
-
name = "quote"
|
|
88
|
-
definition_string = "[quote={TEXT1}]{TEXT2}[/quote]"
|
|
89
|
-
format_string = """
|
|
90
|
-
<blockquote>
|
|
91
|
-
<cite>
|
|
92
|
-
{TEXT1} said:
|
|
93
|
-
</cite>
|
|
94
|
-
{TEXT2}
|
|
95
|
-
</blockquote>"""
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
class RightBBCodeTag(BBCodeTag):
|
|
99
|
-
name = "right"
|
|
100
|
-
definition_string = "[right]{TEXT}[/right]"
|
|
101
|
-
format_string = """<div style="text-align: right">{TEXT}</div>"""
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
class ShadowBBCodeTag(BBCodeTag):
|
|
105
|
-
name = "shadow"
|
|
106
|
-
definition_string = "[shadow={TEXT1}]{TEXT2}[/shadow]"
|
|
107
|
-
format_string = """<span id="bbcode-shadow" style="text-shadow: 0px 0px 1em {TEXT1}">{TEXT2}</span>"""
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
class SizeBBCodeTag(BBCodeTag):
|
|
111
|
-
name = "size"
|
|
112
|
-
definition_string = "[size={RANGE=1,7}]{TEXT}[/size]"
|
|
113
|
-
format_string = '<font size="{RANGE=1,7}">{TEXT}</font>'
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
class SubscriptBBCodeTag(BBCodeTag):
|
|
117
|
-
name = "sub"
|
|
118
|
-
definition_string = "[sub]{TEXT}[/sub]"
|
|
119
|
-
format_string = "<sub>{TEXT}</sub>"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
class SuperscriptBBCodeTag(BBCodeTag):
|
|
123
|
-
name = "sup"
|
|
124
|
-
definition_string = "[sup]{TEXT}[/sup]"
|
|
125
|
-
format_string = "<sup>{TEXT}</sup>"
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
class UlBBCodeTag(BBCodeTag):
|
|
129
|
-
name = "ul"
|
|
130
|
-
definition_string = "[ul]{TEXT}[/ul]"
|
|
131
|
-
format_string = "<ul>{TEXT}</ul>"
|
|
132
|
-
|
|
133
|
-
class Options:
|
|
134
|
-
transform_newlines = False
|
|
135
|
-
strip = True
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
class UncheckedBoxBBCodeTag(BBCodeTag):
|
|
139
|
-
name = "n"
|
|
140
|
-
definition_string = "[n]{TEXT}"
|
|
141
|
-
format_string = """
|
|
142
|
-
<label style="display: block"><input type="checkbox" disabled="disabled" /> {TEXT}</label>"""
|
|
143
|
-
|
|
144
|
-
class Options:
|
|
145
|
-
newline_closes = True
|
|
146
|
-
same_tag_closes = True
|
|
147
|
-
end_tag_closes = True
|
|
148
|
-
strip = True
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
tag_pool.register_tag(CheckedBoxBBCodeTag)
|
|
152
|
-
tag_pool.register_tag(CodeBBCodeTag)
|
|
153
|
-
tag_pool.register_tag(EmailBBCodeTag)
|
|
154
|
-
tag_pool.register_tag(EscapeBBCodeTag)
|
|
155
|
-
tag_pool.register_tag(FontBBCodeTag)
|
|
156
|
-
tag_pool.register_tag(HrBBCodeTag)
|
|
157
|
-
tag_pool.register_tag(LeftBBCodeTag)
|
|
158
|
-
tag_pool.register_tag(LiBBCodeTag)
|
|
159
|
-
tag_pool.register_tag(OlBBCodeTag)
|
|
160
|
-
tag_pool.register_tag(QuoteBBCodeTag)
|
|
161
|
-
tag_pool.register_tag(RightBBCodeTag)
|
|
162
|
-
tag_pool.register_tag(ShadowBBCodeTag)
|
|
163
|
-
tag_pool.register_tag(SizeBBCodeTag)
|
|
164
|
-
tag_pool.register_tag(SubscriptBBCodeTag)
|
|
165
|
-
tag_pool.register_tag(SuperscriptBBCodeTag)
|
|
166
|
-
tag_pool.register_tag(UlBBCodeTag)
|
|
167
|
-
tag_pool.register_tag(UncheckedBoxBBCodeTag)
|
punkweb_bb/parsers.py
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
from django.apps import apps
|
|
2
|
-
from precise_bbcode.bbcode.parser import BBCodeParser
|
|
3
|
-
from precise_bbcode.bbcode.placeholder import BBCodePlaceholder
|
|
4
|
-
from precise_bbcode.core.loading import get_subclasses
|
|
5
|
-
|
|
6
|
-
_shoutbox_parser = None
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def get_shoutbox_parser():
|
|
10
|
-
if not _shoutbox_parser:
|
|
11
|
-
loader = ShoutboxParserLoader()
|
|
12
|
-
loader.load_parser()
|
|
13
|
-
return _shoutbox_parser
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class ShoutboxParserLoader(object):
|
|
17
|
-
def __init__(self, *args, **kwargs):
|
|
18
|
-
global _shoutbox_parser
|
|
19
|
-
_shoutbox_parser = BBCodeParser()
|
|
20
|
-
self.parser = _shoutbox_parser
|
|
21
|
-
|
|
22
|
-
def load_parser(self):
|
|
23
|
-
self.init_default_bbcode_placeholders()
|
|
24
|
-
self.init_bbcode_placeholders()
|
|
25
|
-
self.init_default_bbcode_tags()
|
|
26
|
-
self.init_bbcode_tags()
|
|
27
|
-
self.init_bbcode_smilies()
|
|
28
|
-
|
|
29
|
-
def init_default_bbcode_placeholders(self):
|
|
30
|
-
import precise_bbcode.bbcode.defaults.placeholder
|
|
31
|
-
|
|
32
|
-
for placeholder_klass in get_subclasses(
|
|
33
|
-
precise_bbcode.bbcode.defaults.placeholder, BBCodePlaceholder
|
|
34
|
-
):
|
|
35
|
-
setattr(placeholder_klass, "default_placeholder", True)
|
|
36
|
-
self.parser.add_placeholder(placeholder_klass)
|
|
37
|
-
|
|
38
|
-
def init_bbcode_placeholders(self):
|
|
39
|
-
from precise_bbcode.placeholder_pool import placeholder_pool
|
|
40
|
-
|
|
41
|
-
placeholders = placeholder_pool.get_placeholders()
|
|
42
|
-
for placeholder in placeholders:
|
|
43
|
-
self.parser.add_placeholder(placeholder)
|
|
44
|
-
|
|
45
|
-
def init_default_bbcode_tags(self):
|
|
46
|
-
import precise_bbcode.bbcode.defaults.tag
|
|
47
|
-
|
|
48
|
-
self.parser.add_bbcode_tag(precise_bbcode.bbcode.defaults.tag.StrongBBCodeTag)
|
|
49
|
-
self.parser.add_bbcode_tag(precise_bbcode.bbcode.defaults.tag.ItalicBBCodeTag)
|
|
50
|
-
self.parser.add_bbcode_tag(
|
|
51
|
-
precise_bbcode.bbcode.defaults.tag.UnderlineBBCodeTag
|
|
52
|
-
)
|
|
53
|
-
self.parser.add_bbcode_tag(precise_bbcode.bbcode.defaults.tag.StrikeBBCodeTag)
|
|
54
|
-
self.parser.add_bbcode_tag(precise_bbcode.bbcode.defaults.tag.ColorBBCodeTag)
|
|
55
|
-
self.parser.add_bbcode_tag(precise_bbcode.bbcode.defaults.tag.UrlBBCodeTag)
|
|
56
|
-
|
|
57
|
-
def init_bbcode_tags(self):
|
|
58
|
-
import punkweb_bb.bbcode_tags
|
|
59
|
-
|
|
60
|
-
self.parser.add_bbcode_tag(punkweb_bb.bbcode_tags.FontBBCodeTag)
|
|
61
|
-
self.parser.add_bbcode_tag(punkweb_bb.bbcode_tags.ShadowBBCodeTag)
|
|
62
|
-
self.parser.add_bbcode_tag(punkweb_bb.bbcode_tags.SubscriptBBCodeTag)
|
|
63
|
-
self.parser.add_bbcode_tag(punkweb_bb.bbcode_tags.SuperscriptBBCodeTag)
|
|
64
|
-
|
|
65
|
-
def init_bbcode_smilies(self):
|
|
66
|
-
SmileyTag = apps.get_model("precise_bbcode", "SmileyTag")
|
|
67
|
-
if SmileyTag:
|
|
68
|
-
custom_smilies = SmileyTag.objects.all()
|
|
69
|
-
for smiley in custom_smilies:
|
|
70
|
-
self.parser.add_smiley(smiley.code, smiley.html_code)
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import html
|
|
2
|
-
from django import template
|
|
3
|
-
from django.template.defaultfilters import stringfilter
|
|
4
|
-
from django.utils.safestring import mark_safe
|
|
5
|
-
|
|
6
|
-
from punkweb_bb.parsers import get_shoutbox_parser
|
|
7
|
-
from punkweb_bb.settings import RENDERER
|
|
8
|
-
|
|
9
|
-
register = template.Library()
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@register.filter(is_safe=True)
|
|
13
|
-
@stringfilter
|
|
14
|
-
def shoutbox_render(value):
|
|
15
|
-
if RENDERER == "bbcode":
|
|
16
|
-
parser = get_shoutbox_parser()
|
|
17
|
-
rendered = parser.render(value)
|
|
18
|
-
elif RENDERER == "markdown":
|
|
19
|
-
escaped = html.escape(value, quote=False)
|
|
20
|
-
rendered = escaped
|
|
21
|
-
|
|
22
|
-
return mark_safe(rendered)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|