Compare commits
No commits in common. "60e3ef124b0d8886fc74f4f3ec71b37711444056" and "28d8b6914642e4f71dd23e3316db57a227bea6a1" have entirely different histories.
60e3ef124b
...
28d8b69146
@ -88,7 +88,7 @@ PLANNING_RE = re.compile(
|
||||
r")+\s*"
|
||||
)
|
||||
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
|
||||
@ -1525,10 +1525,10 @@ def dump_contents(raw):
|
||||
bullet = raw.bullet if raw.bullet else raw.counter + raw.counter_sep
|
||||
content = token_list_to_raw(raw.content)
|
||||
checkbox = f"[{raw.checkbox_value}]" if raw.checkbox_value else ""
|
||||
tag = f"{raw.tag_indentation}{token_list_to_raw(raw.tag or '')}::" if raw.tag or raw.tag_indentation else ""
|
||||
tag = f"{raw.tag_indentation}{token_list_to_raw(raw.tag)}::" if raw.tag else ""
|
||||
return (
|
||||
raw.linenum,
|
||||
f"{raw.indentation}{bullet} {checkbox}{tag}{content}",
|
||||
f"{raw.indentation}{bullet}{checkbox}{tag}{content}",
|
||||
)
|
||||
|
||||
elif isinstance(raw, TableRow):
|
||||
|
@ -542,12 +542,12 @@ class TestSerde(unittest.TestCase):
|
||||
# ...
|
||||
lists = hl.getLists()
|
||||
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][1].content,
|
||||
[
|
||||
"This list has multiple elements, with ",
|
||||
" This list has multiple elements, with ",
|
||||
MarkerToken(closing=False, tok_type=MarkerType.UNDERLINED_MODE),
|
||||
"markup",
|
||||
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, "+")
|
||||
|
||||
hl2 = doc.getTopHeadlines()[1]
|
||||
@ -563,19 +563,19 @@ class TestSerde(unittest.TestCase):
|
||||
lists2 = hl2.getLists()
|
||||
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_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_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_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_sep, ")")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user