From 45c0414b3d9c5ba2e9c28291adcdfb3865706050 Mon Sep 17 00:00:00 2001 From: Shawn O'Hare Date: Wed, 30 Dec 2015 21:34:52 -0800 Subject: [PATCH] Add section shortcode. It seems there are some issues in wrapping complex blocks of markdown in html tags, especially when the block contains other short codes. Content would either only partially render or fail completely. --- README.md | 28 ++++++++++++++++++++++------ layouts/shortcodes/section.html | 9 +++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 layouts/shortcodes/section.html diff --git a/README.md b/README.md index fa0674e..f2b77c1 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,28 @@ The site specific parameters that this theme :wrecognizes are: ## Shortcodes -- `sidenote`: Wrap text to produce an automatically numbered sidenote. - The single positional argument is a required unique identifier. - Example: `{{% sidenote "sn-example" %}}Some sidenote{{% /sidenote %}}` -- `marginnote`: Wrap text to produce a numberless margin note. - The single positional argument is a required unique identifier. - Example: `{{% marginnote"mn-example" %}}Some marginnote{{% /marginnote%}}` +This theme provides the following shortcodes. + +- `marginnote` + - Description: Wrap text to produce a numberless margin note. + - Usage: Accepts a required positional argument that is the margin note id. + `{{% marginnote """ %}}...{{% /marginnote %}}` + - Example: `{{% marginnote "mn-example" %}}Some marginnote{{% /marginnote%}}` + +- `section` + - Description: This shortcode is provided as a work-around for wrapping + complex blocks of markdown in section tags. + - Usage: `{{< section "" >}}` map respectively to + `
` and `
` tags. + - Example: `{{< section "begin" >}}` inserts a `
` tag, while + `{{
}}` inserts the closing `
` tag. + +- `sidenote` + - Description: Wrap text to produce an automatically numbered sidenote. + - Usage: identical to `marginnote`. + Accepts a required positional argument that is the side note id. + `{{% sidenote """ %}}...{{% /sidenote %}}` + - Example: `{{% sidenote "sn-example" %}}Some sidenote{{% /sidenote %}}` ## Templates TODO diff --git a/layouts/shortcodes/section.html b/layouts/shortcodes/section.html new file mode 100644 index 0000000..72fbdbb --- /dev/null +++ b/layouts/shortcodes/section.html @@ -0,0 +1,9 @@ +{{ with .Get 0 }} + {{ if eq . "begin" }} +
+ {{ else if eq . "end" }} +
+ {{ end }} +{{ end }} + +