forked from kenkeiras/org-rw
Require whitespace after list bullet.
This commit is contained in:
parent
28d8b69146
commit
d69bf97163
@ -88,7 +88,7 @@ PLANNING_RE = re.compile(
|
|||||||
r")+\s*"
|
r")+\s*"
|
||||||
)
|
)
|
||||||
LIST_ITEM_RE = re.compile(
|
LIST_ITEM_RE = re.compile(
|
||||||
r"(?P<indentation>\s*)((?P<bullet>[*\-+])|((?P<counter>\d|[a-zA-Z])(?P<counter_sep>[.)])))((?P<checkbox_indentation>)\[(?P<checkbox_value>[ Xx])\])?((?P<tag_indentation>\s*)(?P<tag>.*?)::)?(?P<content>.*)"
|
r"(?P<indentation>\s*)((?P<bullet>[*\-+])|((?P<counter>\d|[a-zA-Z])(?P<counter_sep>[.)]))) ((?P<checkbox_indentation>)\[(?P<checkbox_value>[ Xx])\])?((?P<tag_indentation>\s*)(?P<tag>.*?)::)?(?P<content>.*)"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Org-Babel
|
# Org-Babel
|
||||||
@ -1528,7 +1528,7 @@ def dump_contents(raw):
|
|||||||
tag = f"{raw.tag_indentation}{token_list_to_raw(raw.tag)}::" if raw.tag else ""
|
tag = f"{raw.tag_indentation}{token_list_to_raw(raw.tag)}::" if raw.tag else ""
|
||||||
return (
|
return (
|
||||||
raw.linenum,
|
raw.linenum,
|
||||||
f"{raw.indentation}{bullet}{checkbox}{tag}{content}",
|
f"{raw.indentation}{bullet} {checkbox}{tag}{content}",
|
||||||
)
|
)
|
||||||
|
|
||||||
elif isinstance(raw, TableRow):
|
elif isinstance(raw, TableRow):
|
||||||
|
@ -542,12 +542,12 @@ class TestSerde(unittest.TestCase):
|
|||||||
# ...
|
# ...
|
||||||
lists = hl.getLists()
|
lists = hl.getLists()
|
||||||
self.assertEqual(len(lists), 3)
|
self.assertEqual(len(lists), 3)
|
||||||
self.assertEqual(lists[0][0].content, [" This is a simple list."])
|
self.assertEqual(lists[0][0].content, ["This is a simple list."])
|
||||||
self.assertEqual(lists[0][0].bullet, "-")
|
self.assertEqual(lists[0][0].bullet, "-")
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
lists[0][1].content,
|
lists[0][1].content,
|
||||||
[
|
[
|
||||||
" This list has multiple elements, with ",
|
"This list has multiple elements, with ",
|
||||||
MarkerToken(closing=False, tok_type=MarkerType.UNDERLINED_MODE),
|
MarkerToken(closing=False, tok_type=MarkerType.UNDERLINED_MODE),
|
||||||
"markup",
|
"markup",
|
||||||
MarkerToken(closing=True, tok_type=MarkerType.UNDERLINED_MODE),
|
MarkerToken(closing=True, tok_type=MarkerType.UNDERLINED_MODE),
|
||||||
@ -555,7 +555,7 @@ class TestSerde(unittest.TestCase):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(lists[1][0].content, [" This is a simple list."])
|
self.assertEqual(lists[1][0].content, ["This is a simple list."])
|
||||||
self.assertEqual(lists[1][0].bullet, "+")
|
self.assertEqual(lists[1][0].bullet, "+")
|
||||||
|
|
||||||
hl2 = doc.getTopHeadlines()[1]
|
hl2 = doc.getTopHeadlines()[1]
|
||||||
@ -563,19 +563,19 @@ class TestSerde(unittest.TestCase):
|
|||||||
lists2 = hl2.getLists()
|
lists2 = hl2.getLists()
|
||||||
self.assertEqual(len(lists2), 2)
|
self.assertEqual(len(lists2), 2)
|
||||||
|
|
||||||
self.assertEqual(lists2[0][0].content, [" First element"])
|
self.assertEqual(lists2[0][0].content, ["First element"])
|
||||||
self.assertEqual(lists2[0][0].counter, "1")
|
self.assertEqual(lists2[0][0].counter, "1")
|
||||||
self.assertEqual(lists2[0][0].counter_sep, ".")
|
self.assertEqual(lists2[0][0].counter_sep, ".")
|
||||||
|
|
||||||
self.assertEqual(lists2[0][1].content, [" Second element"])
|
self.assertEqual(lists2[0][1].content, ["Second element"])
|
||||||
self.assertEqual(lists2[0][1].counter, "2")
|
self.assertEqual(lists2[0][1].counter, "2")
|
||||||
self.assertEqual(lists2[0][1].counter_sep, ".")
|
self.assertEqual(lists2[0][1].counter_sep, ".")
|
||||||
|
|
||||||
self.assertEqual(lists2[1][0].content, [" First element"])
|
self.assertEqual(lists2[1][0].content, ["First element"])
|
||||||
self.assertEqual(lists2[1][0].counter, "1")
|
self.assertEqual(lists2[1][0].counter, "1")
|
||||||
self.assertEqual(lists2[1][0].counter_sep, ")")
|
self.assertEqual(lists2[1][0].counter_sep, ")")
|
||||||
|
|
||||||
self.assertEqual(lists2[1][1].content, [" Second element"])
|
self.assertEqual(lists2[1][1].content, ["Second element"])
|
||||||
self.assertEqual(lists2[1][1].counter, "2")
|
self.assertEqual(lists2[1][1].counter, "2")
|
||||||
self.assertEqual(lists2[1][1].counter_sep, ")")
|
self.assertEqual(lists2[1][1].counter_sep, ")")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user