Add support for org-roam-v2 style files.

This commit is contained in:
Sergio Martínez Portela 2021-08-03 22:37:03 +02:00
parent 3b6358c195
commit 6943ebad7c
3 changed files with 60 additions and 5 deletions

13
tests/07-org-roam-v2.org Normal file
View file

@ -0,0 +1,13 @@
:PROPERTIES:
:ID: 515054a9-ced8-4119-a844-71726f80dedf
:END:
#+title: 07-org-roam-v2
* Subnode
:PROPERTIES:
:CREATED: [2021-08-03 Mar 22:12]
:ID: 419f4651-21c8-4166-b8d5-692c34be9f93
:END:
** Sub sub node
- This has no ID

View file

@ -488,3 +488,15 @@ class TestSerde(unittest.TestCase):
self.assertEqual(lists2[1][1].content, " Second element")
self.assertEqual(lists2[1][1].counter, "2")
self.assertEqual(lists2[1][1].counter_sep, ")")
def test_org_roam_07(self):
with open(os.path.join(DIR, "07-org-roam-v2.org")) as f:
orig = f.read()
doc = loads(orig)
self.assertEqual(doc.get_property("ID"), "515054a9-ced8-4119-a844-71726f80dedf")
self.assertEqual(len(doc.getTopHeadlines()), 1)
hl = doc.getTopHeadlines()[0]
self.assertEqual(hl.get_property("ID"), "419f4651-21c8-4166-b8d5-692c34be9f93")
self.assertEqual(len(hl.children), 1)