From 37ea872f5c6f0b8269a2b22cc6beca847c2e0c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Sat, 22 Jun 2024 23:02:47 -0400 Subject: [PATCH 1/2] Include a sample file for testing --- Example_note.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 Example_note.txt diff --git a/Example_note.txt b/Example_note.txt new file mode 100755 index 0000000..f0a731a --- /dev/null +++ b/Example_note.txt @@ -0,0 +1,12 @@ +Content-Type: text/x-zim-wiki +Wiki-Format: zim 0.26 +Creation-Date: Not found +Modification-Date: Not found + +====== Example note ====== + +This is a line. + +This is another line. + +http://example.com From 908112fe9cadb7184e6232ca60357acf2d66ace6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Sat, 22 Jun 2024 23:24:01 -0400 Subject: [PATCH 2/2] Convert title to Logseq-amenable metadata --- zimwiki_txt_to_logseq_md.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zimwiki_txt_to_logseq_md.py b/zimwiki_txt_to_logseq_md.py index 5d82b53..12ac6a0 100644 --- a/zimwiki_txt_to_logseq_md.py +++ b/zimwiki_txt_to_logseq_md.py @@ -13,6 +13,14 @@ def rewrite_file(filepath): or (i == 4 and line == "\n") ): continue + if (i == 5): + title_pieces = line.split("======") + if len(title_pieces) == 3: + title = title_pieces[1].strip() + w.write("---\n") + w.write("title: " + title + "\n") + w.write("---\n") + continue w.write(line)