Move the Markdown section parser out of premises into its own module; file the log loop's ellipsis crash as item 41
This commit is contained in:
@@ -16,7 +16,7 @@ import uuid
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
|
||||
|
||||
from loop_claude import file_writes, paths
|
||||
from loop_claude import file_writes, markdown_sections, paths
|
||||
from loop_claude.claude_code import entries, session, transcript, trust
|
||||
from loop_claude.cycle import archive, interrupt, judge, retry, run, states, worker
|
||||
from loop_claude.cycle.limited import Limited
|
||||
@@ -24,7 +24,7 @@ from loop_claude.cycle.verdicts import Finished, Interrupt, QuotedAnswer, Unfini
|
||||
from loop_claude.effects import Effects
|
||||
from loop_claude.failure import Failure
|
||||
from loop_claude.loop import main, reload
|
||||
from loop_claude.project import checkout, model_choice, premises, records
|
||||
from loop_claude.project import checkout, model_choice, records
|
||||
from loop_claude.stop import Stop
|
||||
|
||||
CWD = pathlib.Path("/c")
|
||||
@@ -397,12 +397,12 @@ class Records(unittest.TestCase):
|
||||
class Sections(unittest.TestCase):
|
||||
def test_keeps_every_headed_section_with_its_bodies(self):
|
||||
text = "# Title\n\nintro\n\n## Goals\n\n1. one\n```sh\n# not a heading\n```\n### Later\n2. two\n#1 priority\n\n## Empty\n\n## Audience\nme\n## Audience\nagain\n# Appendix\nnot audience\n"
|
||||
self.assertEqual(premises.sections(text), {"Goals": ["1. one\n```sh\n# not a heading\n```\n### Later\n2. two\n#1 priority"], "Empty": [""], "Audience": ["me", "again"]})
|
||||
self.assertEqual(markdown_sections.sections(text), {"Goals": ["1. one\n```sh\n# not a heading\n```\n### Later\n2. two\n#1 priority"], "Empty": [""], "Audience": ["me", "again"]})
|
||||
|
||||
def test_closes_a_fence_only_on_its_own_marker(self):
|
||||
text = "## Goals\n````md\n~~~\n## Quoted\n```\n````\n ~~~\n## Also quoted\n ~~~\n1. one\n## Audience\nme\n"
|
||||
self.assertEqual(list(premises.sections(text)), ["Goals", "Audience"])
|
||||
self.assertEqual(list(premises.sections("```\nquoted:\n```python\n## Inside\n```\n## Goals\n1. one\n")), ["Goals"])
|
||||
self.assertEqual(list(markdown_sections.sections(text)), ["Goals", "Audience"])
|
||||
self.assertEqual(list(markdown_sections.sections("```\nquoted:\n```python\n## Inside\n```\n## Goals\n1. one\n")), ["Goals"])
|
||||
|
||||
|
||||
class Render(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user