This commit adds the interface ContentReWriter in the tranformer chain.
This is backed by two pooled byte buffers, alternating between being the reader or the writer.
This keeps the performance characteristic of the old implementation, but in a thread safe way.
Fixes#911
Benchmark old vs new:
benchmark old ns/op new ns/op delta
BenchmarkAbsURL 17614 17384 -1.31%
BenchmarkXMLAbsURL 9431 9248 -1.94%
benchmark old allocs new allocs delta
BenchmarkAbsURL 24 28 +16.67%
BenchmarkXMLAbsURL 12 14 +16.67%
benchmark old bytes new bytes delta
BenchmarkAbsURL 3295 3424 +3.92%
BenchmarkXMLAbsURL 1954 1987 +1.69%
Put version handling into the helpers package so it can be used by many,
and split version and suffix to make it possible to calculate the next Hugo version.
Thanks to @bep's new, brilliant helpers.Deprecated() function,
the following functions or variables are transitioned to their
new names, preserving backward compatibility for v0.14
and warning the user of upcoming obsolescence in v0.15:
* .Url → .URL (for node, menu and paginator)
* .Site.BaseUrl → .Site.BaseURL
* .Site.Indexes → .Site.Taxonomies
* .Site.Recent → .Site.Pages
* getJson → getJSON
* getCsv → getCSV
* safeHtml → safeHTML
* safeCss → safeCSS
* safeUrl → safeURL
Also fix related initialisms in strings and comments.
Continued effort in fixing #959.
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
The `hugo help` output as shown in http://gohugo.io/overview/usage/
was not yet updated for v0.13. Thanks to @alebaffa for the heads up!
Also:
- Clarify that, after using `hugo server`, the bare `hugo` command
need to be run before deployment.
- Add a section on running `hugo` as production web server,
and add links to two blog posts of two Hugo users sharing
their experience.
Partially fixes: #852 and #937
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.
A local `node_modules` directory can easily contain
tens of thousands of files, easily exhausting the tiny
default max open files limit especially on OS X Yosemite,
in spite of the fact that Hugo already had code in place
since February 2014 to try to raise the maxfiles ulimit.
Also skip `.git` and `bower_components` directories.
The file watching situation will improve when
https://github.com/go-fsnotify/fsevents become ready,
but until then, we will be thrifty. :-)
Thanks to @chibicode for the suggestion.
See #168 for continued discussions.
The extra step isn't needed and this makes the code simpler.
And slightly faster:
benchmark old ns/op new ns/op delta
BenchmarkAbsUrl 19987 17498 -12.45%
BenchmarkXmlAbsUrl 10606 9503 -10.40%
benchmark old allocs new allocs delta
BenchmarkAbsUrl 28 24 -14.29%
BenchmarkXmlAbsUrl 14 12 -14.29%
benchmark old bytes new bytes delta
BenchmarkAbsUrl 3512 3297 -6.12%
BenchmarkXmlAbsUrl 2059 1963 -4.66%
`eq` and `ne` template functions don't work as expected when those are
used with a raw number and a calculated value by add, sub etc. It's
caused by both numbers type differences. For example, `eq 5 (add 2 3)`
returns `false` because raw 5 is `int` while `add 2 3` returns 5 with
`int64`
This normalizes `int`, `uint` and `float` type values to `int64`,
`uint64` and `float64` before comparing them. Other type of value is
passed to comparing function without any changes.
Fix#961
...
Prevent 404.html from prettifying into 404/index.html
Restore @realchaseadams's commit 348e123
"Force `UglyUrls` option to force `404.html` file name"
which got lost after some refactoring (commit 8db3c0b).
Remove the equivalent "force `UglyUrls`" code for `sitemap.xml`
because the refactored code now calls `renderAndWriteXML()`
which uses `WriteDestFile()` which does not prettify a filename.
Fixes#939 (reverted from commit c4c19ad303)