summaryrefslogtreecommitdiff
path: root/subplot/jt.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-04-12 17:56:20 +0300
committerLars Wirzenius <liw@liw.fi>2021-04-12 18:46:30 +0300
commit3a1f32c817f0b3f28afb9c87215a7502fe48864c (patch)
treef0d39eb5e19be1ebf6f3f53ceb83dfd2ae184e93 /subplot/jt.py
parent924fc1add2de3edac4ad4b1097a3bbbb73d0ad50 (diff)
downloadjt2-3a1f32c817f0b3f28afb9c87215a7502fe48864c.tar.gz
feat: add "new-topic" command and "new --topic" option
This makes it easier to have "topic pages" in a journal, for collecting entries related to a certain topic. The topic page uses ikiwiki's !inline directive to collect pages linking to it.
Diffstat (limited to 'subplot/jt.py')
-rw-r--r--subplot/jt.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/subplot/jt.py b/subplot/jt.py
index 6ce75b0..d6023b3 100644
--- a/subplot/jt.py
+++ b/subplot/jt.py
@@ -135,6 +135,13 @@ def draft_contains_string(ctx, dirname=None, draftno=None, pattern=None):
assert pattern in data
+def draft_links_to_topic(ctx, dirname=None, draftno=None, topic=None):
+ logging.debug(f"checking draft {draftno} in {dirname} links to {topic!r}")
+ draft_contains_string(
+ ctx, dirname=dirname, draftno=draftno, pattern=f'\n[[!meta link="{topic}"]]\n'
+ )
+
+
def edit_draft(ctx, dirname=None, draftno=None, text=None):
logging.debug(f"editing draft {draftno} in {dirname} to also contain {text!r}")
draft = os.path.join(dirname, "drafts", f"{draftno}.md")