El Famoso br fix
This commit is contained in:
parent
e7d3d94847
commit
ea035c8289
|
|
@ -11,12 +11,12 @@
|
||||||
@[custom_permutation]{class="bouyou"}[number=44]
|
@[custom_permutation]{class="bouyou"}[number=44]
|
||||||
|
|
||||||
|
|
||||||
Oneline import @[tab_bnw]{class="sojek"} with three imports @[tab_color] @{image}{class="sojek dark" color="red"}[number=2]
|
- Oneline import @[tab_bnw]{class="sojek"} with three imports @[tab_color] @{image}{class="sojek dark" color="red"}[number=2]
|
||||||
|
|
||||||
add {{class}} at the end of an element for instant bootstrapyfication (class="") (class_insert)
|
- add {{class}} at the end of an element for instant bootstrapyfication (class="") (class_insert)
|
||||||
add {html} at the end of an element to add something to your html markup element (style='border-top: 2px') (html_insert)
|
- add {html} at the end of an element to add something to your html markup element (style='border-top: 2px') (html_insert)
|
||||||
add [statement/str/float] at the end of an element to add something that must be interpreted by the parser
|
- add [statement/str/float] at the end of an element to add something that must be interpreted by the parser
|
||||||
add [int] to modify the path for aliases and images (vuln[1] looks for vuln1.png), you can add multiple with commas for multiple images variations
|
- add [int] to modify the path for aliases and images (vuln[1] looks for vuln1.png), you can add multiple with commas for multiple images variations
|
||||||
|
|
||||||
|
|
||||||
filler
|
filler
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
# container = BaseContainer()
|
# container = BaseContainer()
|
||||||
# container[number] -> The number element in the content
|
# container[number] -> The number element in the content
|
||||||
# "class_insert" >> container[number] -> Get an element from one of the mapped methods
|
# "class_insert" >> container[number] -> Get an element from one of the mapped methods
|
||||||
|
import rich
|
||||||
|
|
||||||
from bootstraparse.modules import syntax, error_mngr, export
|
from bootstraparse.modules import syntax, error_mngr, export
|
||||||
from bootstraparse.modules.error_mngr import MismatchedContainerError, log_exception, log_message, LonelyOptionalError # noqa
|
from bootstraparse.modules.error_mngr import MismatchedContainerError, log_exception, log_message, LonelyOptionalError # noqa
|
||||||
|
|
@ -309,8 +310,11 @@ class TableCellContainer(BaseContainer):
|
||||||
|
|
||||||
|
|
||||||
class LinebreakContainer(BaseContainer):
|
class LinebreakContainer(BaseContainer):
|
||||||
def export(self, _): # TODO: add lookahead for double linebreak to force break
|
def export(self, _):
|
||||||
return "\n"
|
if len(self.content) == 1:
|
||||||
|
return "\n"
|
||||||
|
return "<br />\n"*(len(self.content)-1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
@ -358,7 +362,8 @@ class ContextManager:
|
||||||
"list:ulist": ["list:ulist"],
|
"list:ulist": ["list:ulist"],
|
||||||
"list:olist": ["list:olist"],
|
"list:olist": ["list:olist"],
|
||||||
"table:row": ["table:separator", "table:row"], # TODO: Implement tables
|
"table:row": ["table:separator", "table:row"], # TODO: Implement tables
|
||||||
"blockquotes": [] # TODO: Implement blockquotes
|
"blockquotes": [], # TODO: Implement blockquotes
|
||||||
|
"linebreak": ["linebreak"],
|
||||||
}
|
}
|
||||||
self.contextualised = False
|
self.contextualised = False
|
||||||
|
|
||||||
|
|
@ -441,6 +446,7 @@ class ContextManager:
|
||||||
return self.pile
|
return self.pile
|
||||||
index = 0
|
index = 0
|
||||||
line_number = 1
|
line_number = 1
|
||||||
|
|
||||||
while index < len(self.parsed_list):
|
while index < len(self.parsed_list):
|
||||||
token = self.parsed_list[index]
|
token = self.parsed_list[index]
|
||||||
token.line_number = line_number
|
token.line_number = line_number
|
||||||
|
|
@ -450,11 +456,11 @@ class ContextManager:
|
||||||
try:
|
try:
|
||||||
# Linebreaks
|
# Linebreaks
|
||||||
if isinstance(token, syntax.Linebreak):
|
if isinstance(token, syntax.Linebreak):
|
||||||
self.encapsulate(index, index)
|
# self.encapsulate(index, index)
|
||||||
line_number += 1
|
line_number += 1
|
||||||
|
|
||||||
# Pack the optionnal with the previous container if it exists (else raise error)
|
# Pack the optionnal with the previous container if it exists (else raise error)
|
||||||
elif isinstance(token, syntax.OptionalToken):
|
if isinstance(token, syntax.OptionalToken):
|
||||||
self.get_last_container_in_pile(index).optionals = token
|
self.get_last_container_in_pile(index).optionals = token
|
||||||
self.pile[index] = None
|
self.pile[index] = None
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -307,6 +307,10 @@ class BlockQuoteAuthorToken(SemanticType):
|
||||||
class Linebreak(ExplicitSemanticType):
|
class Linebreak(ExplicitSemanticType):
|
||||||
label = "linebreak"
|
label = "linebreak"
|
||||||
|
|
||||||
|
def __init__(self, content):
|
||||||
|
super().__init__(content)
|
||||||
|
self.content = []
|
||||||
|
|
||||||
def to_container(self, filter_func=None):
|
def to_container(self, filter_func=None):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -454,6 +454,21 @@ _token_list_with_expected_result = [
|
||||||
],
|
],
|
||||||
__GLk(1),
|
__GLk(1),
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
sy.Linebreak([]),
|
||||||
|
sy.Linebreak([]),
|
||||||
|
sy.Linebreak([]),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
context_mngr.LinebreakContainer([
|
||||||
|
sy.Linebreak([]),
|
||||||
|
sy.Linebreak([]),
|
||||||
|
sy.Linebreak([]),
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
__GLk(1),
|
||||||
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
_zipped_token_list_with_expected_result = [
|
_zipped_token_list_with_expected_result = [
|
||||||
|
|
|
||||||
|
|
@ -200,11 +200,20 @@ _list_classes_expected_value = [
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
context_mngr.LinebreakContainer([
|
context_mngr.LinebreakContainer([
|
||||||
sy.Linebreak([""]),
|
sy.Linebreak([]),
|
||||||
]),
|
]),
|
||||||
"\n",
|
"\n",
|
||||||
__GLk(1),
|
__GLk(1),
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
context_mngr.LinebreakContainer([
|
||||||
|
sy.Linebreak([]),
|
||||||
|
sy.Linebreak([]),
|
||||||
|
sy.Linebreak([]),
|
||||||
|
]),
|
||||||
|
"<br />\n<br />\n",
|
||||||
|
__GLk(1),
|
||||||
|
]
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue