From 67fca36ecc3388a553889d438a256db6be177a1b Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 1 Sep 2022 19:51:11 +0300 Subject: 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 --- riki.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'riki.md') 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 "foo!123" +then file output/a.html contains "foo!123" ~~~ -~~~{#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 -- cgit v1.2.1