summaryrefslogtreecommitdiffstats
path: root/hugolib/shortcode.go
AgeCommit message (Collapse)Author
2015-04-30shortcodeparser: fix panic on slash following opening shortcode commentbep
Fixes #1093
2015-04-29Return error from HandleShortcodesbep
To be able to test for it.
2015-04-19Add shortcut to Scratch from shortcodebep
2015-04-18Polish func naming in shortcode handlingbep
2015-04-18Remove unused types Shortcode and ShortcodeFuncbep
2015-03-29Fix shortcode handling in ToCbep
Fixes #1010
2015-03-11Correct initialisms as suggested by golintAnthony Fok
First step to use initialisms that golint suggests, for example: Line 116: func GetHtmlRenderer should be GetHTMLRenderer as see on http://goreportcard.com/report/spf13/hugo Thanks to @bep for the idea! Note that command-line flags (cobra and pflag) as well as struct fields like .BaseUrl and .Url that are used in Go HTML templates need more work to maintain backward-compatibility, and thus are NOT yet dealt with in this commit. First step in fixing #959.
2015-03-07hugolib: apply some more Golint rulesbep
2015-03-06Fix errors reported by Go Vetbep
2015-03-02Allow the same shortcode to be used with or without inline contentbep
Fixes #934
2015-02-28Improve error message on missing shortcode inner contentbep
Fixes #933
2015-02-20Avoid race condition in isInnerShortcodebep
As reported by Go's race detector. See #917
2015-01-31Updating shortcode imports & site test to work with new buffer pool functionsspf13
2015-01-31Merge branch 'master' of github.com:spf13/hugospf13
2015-01-30Use a regular expression in replaceShortcodeTokensJeffrey Tolar
This fixes a bug where a shortcode needs to be expanded multiple times, which can arise in practice when using reference links.
2015-01-30shortcodes using BBPspf13
2015-01-26Add site-wide/per-page [blackfriday] `extensions` optionNaoya Inada
2015-01-21Protect the innerShortCodeCache by a RW lockbep
2015-01-15Fix issue with nested shortcodesbep
Fixes #797
2014-12-26Add configurable support for angled quotesbep
The flag `HTML_SMARTYPANTS_ANGLED_QUOTES` was added to Blackfriday on Black Friday. This configures rendering of double quotes as angled left and right quotes (« »). Typical use cases would be either or, or combined, but never in the same document. As an example would be a person from Norway; he has a blog in both English and Norwegian (his native tongue); he would then configure Blackfriday to use angled quotes for the Norwegian section, but keep them as reqular double quotes for the English. This commit adds configuration support for this new flag, configuration that can be set in the site configuration, but overridden in page front matter. Fixes #605
2014-12-18Provide (relative) reference funcs & shortcodes.Austin Ziegler
- `.Ref` and `.RelRef` take a reference (the logical filename for a page, including extension and/or a document fragment ID) and return a permalink (or relative permalink) to the referenced document. - If the reference is a page name (such as `about.md`), the page will be discovered and the permalink will be returned: `/about/` - If the reference is a page name with a fragment (such as `about.md#who`), the page will be discovered and used to add the `page.UniqueID()` to the resulting fragment and permalink: `/about/#who:deadbeef`. - If the reference is a fragment and `.*Ref` has been called from a `Node` or `SiteInfo`, it will be returned as is: `#who`. - If the reference is a fragment and `.*Ref` has been called from a `Page`, it will be returned with the page’s unique ID: `#who:deadbeef`. - `.*Ref` can be called from either `Node`, `SiteInfo` (e.g., `Node.Site`), `Page` objects, or `ShortcodeWithPage` objects in templates. - `.*Ref` cannot be used in content, so two shortcodes have been created to provide the functionality to content: `ref` and `relref`. These are intended to be used within markup, like `[Who]({{% ref about.md#who %}})` or `<a href="{{% ref about.md#who %}}">Who</a>`. - There are also `ref` and `relref` template functions (used to create the shortcodes) that expect a `Page` or `Node` object and the reference string (e.g., `{{ relref . "about.md" }}` or `{{ "about.md" | ref . }}`). It actually looks for `.*Ref` as defined on `Node` or `Page` objects. - Shortcode handling had to use a *differently unique* wrapper in `createShortcodePlaceholder` because of the way that the `ref` and `relref` are intended to be used in content.
2014-11-20Move template library into it's own package (tpl). No longer dependent on ↵spf13
hugolib. Can be used externally.
2014-11-18Fix failing shortcode tests on Travisbep
Some newly added shortcode tests compared maps in assertions. This failed on Travis, as iteration order isn't guaranteed for maps since Go 1. This commit fixes that by do a sort of the keys in the shortcode String() function.
2014-11-17Shortcode rewrite, take 2bep
This commit contains a restructuring and partial rewrite of the shortcode handling. Prior to this commit rendering of the page content was mingled with handling of the shortcodes. This led to several oddities. The new flow is: 1. Shortcodes are extracted from page and replaced with placeholders. 2. Shortcodes are processed and rendered 3. Page is processed 4. The placeholders are replaced with the rendered shortcodes The handling of summaries is also made simpler by this. This commit also introduces some other chenges: 1. distinction between shortcodes that need further processing and those who do not: * `{{< >}}`: Typically raw HTML. Will not be processed. * `{{% %}}`: Will be processed by the page's markup engine (Markdown or (infuture) Asciidoctor) The above also involves a new shortcode-parser, with lexical scanning inspired by Rob Pike's talk called "Lexical Scanning in Go", which should be easier to understand, give better error messages and perform better. 2. If you want to exclude a shortcode from being processed (for documentation etc.), the inner part of the shorcode must be commented out, i.e. `{{%/* movie 47238zzb */%}}`. See the updated shortcode section in the documentation for further examples. The new parser supports nested shortcodes. This isn't new, but has two related design choices worth mentioning: * The shortcodes will be rendered individually, so If both `{{< >}}` and `{{% %}}` are used in the nested hierarchy, one will be passed through the page's markdown processor, the other not. * To avoid potential costly overhead of always looking far ahead for a possible closing tag, this implementation looks at the template itself, and is branded as a container with inner content if it contains a reference to `.Inner` Fixes #565 Fixes #480 Fixes #461 And probably some others.
2014-10-16Big refactor of how source files are used. Also added default destination ↵spf13
extension option.
2014-10-07Use md5 against the file path for uniqueness.Austin Ziegler
2014-10-07Make each generated page’s footnotes unique.Austin Ziegler
If content pages are fully rendered in a list page, footnotes that use the same reference (`[^fn]`) will have duplicated anchors. This change builds on #526 to put the page filename (`Page.File.Name`) as part of the anchor for a footnote. This would fix discussion [116](http://discuss.gohugo.io/t/footnote-references-are-duplicated-on-list-pages/116).
2014-08-28Inner Shortcodes now treated as markdown. fixed #185spf13
2014-06-30Add shortcode template loading from themes directory.Nicholas Whittier
2014-04-23Add Disqus support out of the box. Move template/bundle into hugolib.spf13
2014-03-31Adding support for logging & verbose logging. Consolidation of error ↵spf13
handling. Integration of jWalterWeatherman library. Fixed #137
2014-02-25Shortcode cleanup. Added a ton of tests. Much more flexible with input. ↵spf13
Doesn't crash with bad input. Fixed #193 Also added the .Get function to short codes and documentation for that function.
2014-02-20Warn about bad shortcode parameters (and don't crash)Ask Bjørn Hansen
closes #193
2014-01-29gofmt all go codeTibor Vass
2014-01-10Adding some embedded short codes (including code highlighting)spf13
2013-12-16GofmtCaleb Spare
Command: `gofmt -l -s -w .`
2013-12-06adding support for shortcodes with opening and closing tagsspf13
2013-09-03Code reorg, helpers.go has been decomposed.Noah Campbell
It started with wanting to move templates in template bundles and the rest followed. I did my best to start grouping related functions together, but there are some that I missed. There is also the method Urlize that seems to be a special function used in both worlds. I'll need to revisit this method.
2013-09-01Add support for amber filesFabrizio (Misto) Milo
If a layout file ends with .amber it will interpreted as a Amber file Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-07-04adding hugospf13