correct invalid void tags
This commit is contained in:
@@ -6,7 +6,7 @@ from pygments.lexers import get_lexer_by_name
|
|||||||
from pygments.util import ClassNotFound as PygmentsClassNotFound
|
from pygments.util import ClassNotFound as PygmentsClassNotFound
|
||||||
import re
|
import re
|
||||||
|
|
||||||
BABYCODE_VERSION = 7
|
BABYCODE_VERSION = 8
|
||||||
|
|
||||||
class BabycodeError(Exception):
|
class BabycodeError(Exception):
|
||||||
pass
|
pass
|
||||||
@@ -441,15 +441,15 @@ RSS_TAGS = {
|
|||||||
VOID_TAGS = {
|
VOID_TAGS = {
|
||||||
'lb': lambda attr: '[',
|
'lb': lambda attr: '[',
|
||||||
'rb': lambda attr: ']',
|
'rb': lambda attr: ']',
|
||||||
'@': lambda attr: '@',
|
'at': lambda attr: '@',
|
||||||
'-': lambda attr: '-',
|
'd': lambda attr: '-',
|
||||||
}
|
}
|
||||||
|
|
||||||
# [img] is considered block for the purposes of collapsing whitespace,
|
# [img] is considered block for the purposes of collapsing whitespace,
|
||||||
# despite being potentially inline (since the resulting <img> tag is inline, but creates a block container around itself and sibling images).
|
# despite being potentially inline (since the resulting <img> tag is inline, but creates a block container around itself and sibling images).
|
||||||
# [code] has a special case in is_inline().
|
# [code] has a special case in is_inline().
|
||||||
INLINE_TAGS = {
|
INLINE_TAGS = {
|
||||||
'b', 'i', 's', 'u', 'color', 'big', 'small', 'url', 'lb', 'rb', '@'
|
'b', 'i', 's', 'u', 'color', 'big', 'small', 'url', 'lb', 'rb', 'at', 'd'
|
||||||
}
|
}
|
||||||
|
|
||||||
def is_tag(e, tag=None):
|
def is_tag(e, tag=None):
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
<p>Multiple images attached to a post can be clicked to open a dialog to view them.</p>
|
<p>Multiple images attached to a post can be clicked to open a dialog to view them.</p>
|
||||||
</section>
|
</section>
|
||||||
<section class="guide-section">
|
<section class="guide-section">
|
||||||
<h2 id="adding-code-blocks">Adding code blocks</h2>
|
<h2 id="adding-code-blocks">Adding code blocūs</h2>
|
||||||
{% set code = 'func _ready() -> void:\n\tprint("hello world!")' %}
|
{% set code = 'func _ready() -> void:\n\tprint("hello world!")' %}
|
||||||
<p>There are two kinds of code blocks recognized by babycode: inline and block. Inline code blocks do not break a paragraph. They can be added with <code class="inline-code">[code]your code here[/code]</code>. As long as there are no line breaks inside the code block, it is considered inline. If there are any, it will produce this:</p>
|
<p>There are two kinds of code blocks recognized by babycode: inline and block. Inline code blocks do not break a paragraph. They can be added with <code class="inline-code">[code]your code here[/code]</code>. As long as there are no line breaks inside the code block, it is considered inline. If there are any, it will produce this:</p>
|
||||||
{{ ('[code]%s[/code]' % code) | babycode | safe }}
|
{{ ('[code]%s[/code]' % code) | babycode | safe }}
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
</section>
|
</section>
|
||||||
<section class="guide-section">
|
<section class="guide-section">
|
||||||
<h2 id="void-tags">Void tags</h2>
|
<h2 id="void-tags">Void tags</h2>
|
||||||
<p>The special void tags <code class="inline-code">[lb]</code>, <code class="inline-code">[rb]</code>, <code class="inline-code">[-]</code> and <code class="inline-code">[@]</code> will appear as the literal characters <code class="inline-code">[</code>, <code class="inline-code">]</code>, and <code class="inline-code">@</code> respectively. Unlike other tags, they are self-contained and have no closing equivalent.</p>
|
<p>The special void tags <code class="inline-code">[lb]</code>, <code class="inline-code">[rb]</code>, <code class="inline-code">[d]</code> and <code class="inline-code">[at]</code> will appear as the literal characters <code class="inline-code">[</code>, <code class="inline-code">]</code>, <code class="inline-code">-</code>, and <code class="inline-code">@</code> respectively. Unlike other tags, they are self-contained and have no closing equivalent.</p>
|
||||||
<ul class="guide-list">
|
<ul class="guide-list">
|
||||||
{% set lbrb = "[color=red]This text will be red[/color]\n\n[lb]color=red[rb]This text won't be red[lb]/color[rb]" %}
|
{% set lbrb = "[color=red]This text will be red[/color]\n\n[lb]color=red[rb]This text won't be red[lb]/color[rb]" %}
|
||||||
<li><code class="inline-code">[lb]</code> and <code class="inline-code">[rb]</code> allow you to use square brackets without them being interpreted as Babycode:
|
<li><code class="inline-code">[lb]</code> and <code class="inline-code">[rb]</code> allow you to use square brackets without them being interpreted as Babycode:
|
||||||
@@ -186,8 +186,8 @@
|
|||||||
Will result in:<br>
|
Will result in:<br>
|
||||||
{{ lbrb | babycode | safe }}
|
{{ lbrb | babycode | safe }}
|
||||||
</li>
|
</li>
|
||||||
<li>The <code class="inline-code">[@]</code> tag allows you to use the @ symbol without it being turned into a mention.</li>
|
<li>The <code class="inline-code">[at]</code> tag allows you to use the @ symbol without it being turned into a mention.</li>
|
||||||
<li>The <code class="inline-code">[-]</code> tag allows you to use the - (dash) symbol without it being turned into a rule.</li>
|
<li>The <code class="inline-code">[d]</code> tag allows you to use the - (dash) symbol without it being turned into a rule.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user