Some variables are currently not documented and others are explained
across the document. So, I tried to pull an overview from the source.
Pls double check. I am not 100% sure, what the purpose of some variables
is or whether they are only relevant for previous versions. Thanks
This commit replaces the multuple `bytes.Containts` and `bytes.Replace` with a custom replacer that does one pass through the document and exploits the fact that there are two common prefixes we search for, `src=` and `href=`.
This is both faster and consumes less memory. There may be even better algos to use here, but we must leave some room for improvements for future versions.
This should also make it possible to solve #816.
```
benchmark old ns/op new ns/op delta
BenchmarkAbsUrl 25795 22597 -12.40%
BenchmarkXmlAbsUrl 17187 11166 -35.03%
benchmark old allocs new allocs delta
BenchmarkAbsUrl 60 33 -45.00%
BenchmarkXmlAbsUrl 30 16 -46.67%
benchmark old bytes new bytes delta
BenchmarkAbsUrl 5844 4167 -28.70%
BenchmarkXmlAbsUrl 3754 2069 -44.89%
```
Fixes#894
- Add copyright years and author to the top of the file
- Write the current year from time.Now() to LICENSE.md
- Correct comment regarding `os.MkdirAll(p, 0777)`
- In createConfig(), split the `map[string]string` definition into
multiple lines to facilitate future expansion. Also add a trailing
slash to sample "baseurl" definition.
- Update theme.toml template to match that listed at
https://github.com/spf13/hugoThemes/blob/master/README.md#themetoml
See #883 for an equivalent `struct` implementation
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.