diff options
author | Anthony Fok <foka@debian.org> | 2015-01-23 11:59:14 -0700 |
---|---|---|
committer | spf13 <steve.francia@gmail.com> | 2015-03-12 22:01:49 -0400 |
commit | 358dcce7a6b4a8100964597f81cf371451f6c4d3 (patch) | |
tree | 8a018a4b8da70e89bd6f5da73889470b7a45566f /helpers/general_test.go | |
parent | fbcda03029ae6ca04253b7008cfd62921baa092a (diff) |
Experimental AsciiDoc support with external helpers
See #470
* Based on existing support for reStructuredText files
* Handles content files with extensions `.asciidoc` and `.ad`
* Pipes content through `asciidoctor --safe -`.
If `asciidoctor` is not installed, then `asciidoc --safe -`.
* To make sure `asciidoctor` or `asciidoc` is found, after adding
a piece of AsciiDoc content, run `hugo` with the `-v` flag
and look for this message:
INFO: 2015/01/23 Rendering with /usr/bin/asciidoctor ...
Caveats:
* The final "Last updated" timestamp is currently not stripped.
* When `hugo` is run with `-v`, you may see a lot of these messages
INFO: 2015/01/23 Rendering with /usr/bin/asciidoctor ...
if you have lots of `*.ad`, `*.adoc` or `*.asciidoc` files.
* Some versions of `asciidoc` may have trouble with its safe mode.
To test if you are affected, try this:
$ echo "Hello" | asciidoc --safe -
asciidoc: ERROR: unsafe: ifeval invalid
asciidoc: FAILED: ifeval invalid safe document
If so, I recommend that you install `asciidoctor` instead.
Feedback and patches welcome!
Ideally, we should be using https://github.com/VonC/asciidocgo,
@VonC's wonderful Go implementation of Asciidoctor. However,
there is still a bit of work needed for asciidocgo to expose
its API so that Hugo can actually use it.
Until then, hope this "experimental AsciiDoc support through external
helpers" can serve as a stopgap solution for our community. :-)
2015-01-30: Updated for the replaceShortcodeTokens() syntax change
2015-02-21: Add `.adoc` extension as suggested by @Fale
Conflicts:
helpers/content.go
Diffstat (limited to 'helpers/general_test.go')
-rw-r--r-- | helpers/general_test.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/helpers/general_test.go b/helpers/general_test.go index c727560b4..e185fe08c 100644 --- a/helpers/general_test.go +++ b/helpers/general_test.go @@ -15,6 +15,9 @@ func TestGuessType(t *testing.T) { {"md", "markdown"}, {"markdown", "markdown"}, {"mdown", "markdown"}, + {"asciidoc", "asciidoc"}, + {"adoc", "asciidoc"}, + {"ad", "asciidoc"}, {"rst", "rst"}, {"html", "html"}, {"htm", "html"}, |