summaryrefslogtreecommitdiff
path: root/riki.md
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-09-01 19:51:11 +0300
committerLars Wirzenius <liw@liw.fi>2022-09-01 19:51:20 +0300
commit67fca36ecc3388a553889d438a256db6be177a1b (patch)
treedc02388dfd36c0792a3849f082574b27a5b3824d /riki.md
parent0ba22ee78aef7c05613773298319820520653270 (diff)
downloadriki-67fca36ecc3388a553889d438a256db6be177a1b.tar.gz
feat: allow shortcuts to be defined anywhere
ikiwiki requires shortcuts to be defined in a paged called "shortcuts". We allow them anywhere, but this requires us to introduce a preparation phase: directives (shortcuts only for now) can be asked to prepare before they're later processed. For shortcuts preparing means adding the shortcut to the site's list of shortcuts. Sponsored-by: author
Diffstat (limited to 'riki.md')
-rw-r--r--riki.md13
1 files changed, 8 insertions, 5 deletions
diff --git a/riki.md b/riki.md
index dffd617..9ec7d8e 100644
--- a/riki.md
+++ b/riki.md
@@ -469,17 +469,20 @@ like a directive._
~~~scenario
given an installed riki
-given file site/index.mdwn from shortcut
+given file site/a.mdwn from use_shortcut
+given file site/b.mdwn from define_shortcut
when I run riki build site output
-then file output/index.html contains "<a href="https://example.com/foo/123">foo!123</a>"
+then file output/a.html contains "<a href="https://example.com/foo/123">foo!123</a>"
~~~
-~~~{#shortcut .file .markdown}
-[[!shortcut name="foo" url="https://example.com/foo/%s" desc="foo!%s"]]
-
+~~~{#use_shortcut .file .markdown}
[[!foo 123]]
~~~
+~~~{#define_shortcut .file .markdown}
+[[!shortcut name="foo" url="https://example.com/foo/%s" desc="foo!%s"]]
+~~~
+
## Source file tree
### Listing source files