Fix extraction of block element contents.
Don't confound normal characters with formatting markers. Handle escaping of otherwise headline starters with a comma.
This commit is contained in:
parent
66d061dfda
commit
8832cd0b3d
3 changed files with 45 additions and 10 deletions
|
@ -36,3 +36,16 @@ exit 0 # Comment
|
|||
This is another test
|
||||
with two lines too
|
||||
:end:
|
||||
|
||||
* Escaped code
|
||||
:PROPERTIES:
|
||||
:ID: 04-code-escaped-code-id
|
||||
:CREATED: [2020-01-01 Wed 01:01]
|
||||
:END:
|
||||
|
||||
#+BEGIN_SRC c :results drawer
|
||||
/* This code has to be escaped to
|
||||
,* avoid confusion with new headlines.
|
||||
,*/
|
||||
main(){}
|
||||
#+END_SRC
|
||||
|
|
|
@ -433,7 +433,7 @@ class TestSerde(unittest.TestCase):
|
|||
doc = load(f)
|
||||
|
||||
snippets = list(doc.get_code_snippets())
|
||||
self.assertEqual(len(snippets), 2)
|
||||
self.assertEqual(len(snippets), 3)
|
||||
self.assertEqual(
|
||||
snippets[0].content,
|
||||
'echo "This is a test"\n'
|
||||
|
@ -456,6 +456,14 @@ class TestSerde(unittest.TestCase):
|
|||
snippets[1].result, "This is another test\n" + "with two lines too"
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
snippets[2].content,
|
||||
'/* This code has to be escaped to\n'
|
||||
+ ' * avoid confusion with new headlines.\n'
|
||||
+ ' */\n'
|
||||
+ 'main(){}',
|
||||
)
|
||||
|
||||
def test_mimic_write_file_05(self):
|
||||
with open(os.path.join(DIR, "05-dates.org")) as f:
|
||||
orig = f.read()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue