So that the date would come out correctly with
variations like `MetaDataFormat = "YAML"` in addition to
the normally expected `MetaDataFormat = "yaml"`.
Fixes#865.
Allocates less memory:
benchmark old ns/op new ns/op delta
BenchmarkStripHTML 6572 6695 +1.87%
benchmark old allocs new allocs delta
BenchmarkStripHTML 5 4 -20.00%
benchmark old bytes new bytes delta
BenchmarkStripHTML 848 737 -13.09%
Compared to 0.12:
benchmark old ns/op new ns/op delta
BenchmarkStripHTML 10210 6695 -34.43%
benchmark old allocs new allocs delta
BenchmarkStripHTML 6 4 -33.33%
benchmark old bytes new bytes delta
BenchmarkStripHTML 1456 737 -49.38%
go test -test.run=NONE -bench=".*" -test.benchmem=true ./helpers
Old vs new impl (string.Replace vs string.Replacer):
benchmark old ns/op new ns/op delta
BenchmarkStripHTML 10210 6572 -35.63%
benchmark old allocs new allocs delta
BenchmarkStripHTML 6 5 -16.67%
benchmark old bytes new bytes delta
BenchmarkStripHTML 1456 848 -41.76%
Tighten README for the sloppy reader
Tighten README for the sloppy reader
Fixing heads
tigheten markdown
tighten markdown
tighten markdown
tinker with headings
tinker with wording
fixing period spacing
moving the any dir stuff into the feature section
tweak overview
tweak overview
fixed option too
fix break:
Added a new Template.PrintErrors() function call,
used in hugolib/site.go#Process() so it does not clutter
up `go test -v ./...` results.
Special thanks to @tatsushid for mapping out the call trace
which makes it a lot easier to find the appropriate places
to place the Template.PrintErrors() call.
Fixes#316
The variable scope in the Go templates makes it hard, if possible at all, to write templates with counter variables or similar state.
This commit fixes that by adding a writable context to Node, backed by a map: Scratch.
This context has three methods, Get, Set and Add. The Add is tailored for counter variables, but can be used for any built-in numeric values or strings.
Use `{{ if not .Date.IsZero }}` to print dates only when they are
defined. This is to avoid things like
<lastBuildDate>Mon, 01 Jan 0001 00:00:00 +0000</lastBuildDate>
and
<lastmod>0001-01-01T00:00:00+00:00</lastmod>
showing up in index.xml (RSS) and sitemap.xml.
Pipe dates with ±hh:mm time zone through `safeHtml`
to prevent the `+` sign from turning into `+`.
Also make some shuffling to avoid blank lines in the output.