summaryrefslogtreecommitdiff
path: root/riki.md
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-08-10 07:58:06 +0300
committerLars Wirzenius <liw@liw.fi>2022-08-10 09:05:02 +0300
commit1a2ea902b9a2df7c6e2b95acaf8e7e9e2c43851c (patch)
tree047ec38a73489c2fd32dd3cb2481787c05438a31 /riki.md
parent454368dfbf11dad54567f004b94db90118bfc0b2 (diff)
downloadriki-1a2ea902b9a2df7c6e2b95acaf8e7e9e2c43851c.tar.gz
feat: implement shortcut directive
Sponsored-by: author
Diffstat (limited to 'riki.md')
-rw-r--r--riki.md114
1 files changed, 67 insertions, 47 deletions
diff --git a/riki.md b/riki.md
index e5ae0f0..912dbac 100644
--- a/riki.md
+++ b/riki.md
@@ -334,7 +334,7 @@ then AST of site/page.mdwn matches that of output/page.html
* [x] done
~~~
-## Definition list
+### Definition list
_Requirement: Markup indicating use of a definition list should be
flagged as an error._
@@ -380,40 +380,7 @@ foo
~~~
-## Input files other than Markdown
-
-_Requirement: Input files that aren't Markdown files must be copied
-into the destination directory as-is._
-
-~~~scenario
-given an installed riki
-given file site/image.jpg from image
-when I run riki build --plain-body site output
-then files site/image.jpg and output/image.jpg match
-~~~
-
-
-~~~{#image .file}
-# Dummy
-Pretend this is an image.
-~~~
-
-## Input files in sub=directories
-
-_Requirement: If an source page or file is in a sub-directory, it
-should be put in the corresponding sub-directory in the target
-directory._
-
-~~~scenario
-given an installed riki
-given file site/foo/page.mdwn from image
-given file site/bar/image.jpg from para
-when I run riki build --plain-body site output
-then AST of site/foo/page.mdwn matches that of output/foo/page.html
-then files site/bar//image.jpg and output/bar/image.jpg match
-~~~
-
-## Wiki links to other pages on the site
+### Wiki links to other pages on the site
_Requirement: Pages can link to other pages on the site, the same
way ikiwiki does, including subpages._
@@ -442,7 +409,7 @@ Note the uppercase link to the `child` page in the test page below.
[[CHILD]]
~~~
-## Wiki links to pages that don't exist
+### Wiki links to pages that don't exist
_Requirement: Linking to a page that doesn't exist is an error._
@@ -459,6 +426,27 @@ then command fails
## Directives
+### `img`
+
+_Requirement: the `img` directive embeds an image in the generated
+HTML page._
+
+~~~scenario
+given an installed riki
+given file site/index.mdwn from img
+given file site/img.jpg from jpeg
+when I run riki build site output
+then file output/index.html contains "<img src="img.jpg""
+~~~
+
+~~~{#img .file .markdown}
+[[!img img.jpg]]]
+~~~
+
+~~~{#jpeg .file}
+This is a dummy JPEG image.
+~~~
+
### `meta title`
_Requirement: the `meta title` directive sets page title._
@@ -474,25 +462,22 @@ then file output/index.html contains "<title>Yo</title>"
[[!meta title=Yo]]]
~~~
-### `img`
+### `shortcut`
-_Requirement: the `img` directive embeds an image in the generated
-HTML page._
+_Requirement: the `shortcut` directive created a shortcut that looks
+like a directive._
~~~scenario
given an installed riki
-given file site/index.mdwn from img
-given file site/img.jpg from jpeg
+given file site/index.mdwn from shortcut
when I run riki build site output
-then file output/index.html contains "<img src="img.jpg""
+then file output/index.html contains "<a href="https://example.com/foo/123">foo!123</a>"
~~~
-~~~{#img .file .markdown}
-[[!img img.jpg]]]
-~~~
+~~~{#shortcut .file .markdown}
+[[!shortcut name="foo" url="https://example.com/foo/%s" desc="foo!%s"]]
-~~~{#jpeg .file}
-This is a dummy JPEG image.
+[[!foo 123]]
~~~
## Source file tree
@@ -530,6 +515,41 @@ then stdout doesn't contain "index.mdwn~"
then stdout doesn't contain "#index.mdwn#"
~~~
+
+
+## Input files other than Markdown
+
+_Requirement: Input files that aren't Markdown files must be copied
+into the destination directory as-is._
+
+~~~scenario
+given an installed riki
+given file site/image.jpg from image
+when I run riki build --plain-body site output
+then files site/image.jpg and output/image.jpg match
+~~~
+
+
+~~~{#image .file}
+# Dummy
+Pretend this is an image.
+~~~
+
+## Input files in sub-directories
+
+_Requirement: If an source page or file is in a sub-directory, it
+should be put in the corresponding sub-directory in the target
+directory._
+
+~~~scenario
+given an installed riki
+given file site/foo/page.mdwn from image
+given file site/bar/image.jpg from para
+when I run riki build --plain-body site output
+then AST of site/foo/page.mdwn matches that of output/foo/page.html
+then files site/bar//image.jpg and output/bar/image.jpg match
+~~~
+
## Output directory tree
### No markdown files in output tree