Format with black, use tokens for markup segmentation.
- Don't use trees in first instance as interleaving might be lossy.
This commit is contained in:
parent
f6de69fd90
commit
e73ce5d480
5 changed files with 356 additions and 274 deletions
|
@ -5,7 +5,7 @@ from datetime import datetime as DT
|
|||
|
||||
from org_dom import dumps, load, loads
|
||||
from utils.dom_assertions import (BOLD, CODE, HL, ITALIC, SPAN, STRIKE,
|
||||
UNDERLINED, VERBATIM, WEB_LINK, Dom,)
|
||||
UNDERLINED, VERBATIM, WEB_LINK, Dom, Tokens)
|
||||
|
||||
DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
@ -47,7 +47,7 @@ class TestSerde(unittest.TestCase):
|
|||
self.assertEqual(dumps(doc), orig)
|
||||
|
||||
def test_markup_file_02(self):
|
||||
self.maxDiff = 1024
|
||||
self.maxDiff = 10000
|
||||
with open(os.path.join(DIR, '02-markup.org')) as f:
|
||||
doc = load(f)
|
||||
|
||||
|
@ -82,11 +82,33 @@ class TestSerde(unittest.TestCase):
|
|||
SPAN(" This is a nested ", BOLD(["bold ", VERBATIM(["verbatim ", ITALIC(["italic ", STRIKE(["strike ", UNDERLINED(["underlined ", CODE("code ."), " ."]), " ."]), " ."]), " ."]), " ."])),
|
||||
SPAN("\n"),
|
||||
|
||||
# SPAN(""),
|
||||
# # TODO: THIS IS INTERLEAVED, not nested
|
||||
# In ORG: This is a interleaved *bold =verbatim /italic +strike _underlined ~code .* .= ./ .+ ._ .~
|
||||
# SPAN(" This is a nested ", BOLD(["bold ", VERBATIM(["verbatim ", ITALIC(["italic ", STRIKE(["strike ", UNDERLINED(["underlined ", CODE("code ."), " ."]), " ."]), " ."]), " ."]), " ."])),
|
||||
# SPAN(""),
|
||||
SPAN("\n"),
|
||||
# THIS IS INTERLEAVED, not nested
|
||||
SPAN([" This is a interleaved ",
|
||||
Tokens.BOLD_START,
|
||||
"bold ",
|
||||
Tokens.VERBATIM_START,
|
||||
"verbatim ",
|
||||
Tokens.ITALIC_START,
|
||||
"italic ",
|
||||
Tokens.STRIKE_START,
|
||||
"strike ",
|
||||
Tokens.UNDERLINED_START,
|
||||
"underlined ",
|
||||
Tokens.CODE_START,
|
||||
"code .",
|
||||
Tokens.BOLD_END,
|
||||
" .",
|
||||
Tokens.VERBATIM_END,
|
||||
" .",
|
||||
Tokens.ITALIC_END,
|
||||
" .",
|
||||
Tokens.STRIKE_END,
|
||||
" .",
|
||||
Tokens.UNDERLINED_END,
|
||||
" .",
|
||||
Tokens.CODE_END,
|
||||
"\n"]),
|
||||
|
||||
SPAN("\n"),
|
||||
SPAN(" This is a _ non-underlined phrase because an incorrectly placed content _.\n"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue