Commit graph

1851 commits

Author SHA1 Message Date
Cyrill Schumacher
5e2d3d2e10 Merge to stay up to date with current dev
Feature: GetJson and GetJson in short codes or other layout files.
For more details please see: http://cyrillschumacher.com/2014/12/21/dynamic-pages-with-gohugo.io/
2015-02-17 12:14:39 -05:00
Anthony Fok
9bf223e584 Quote strings in hugo config output
Also, use ` = ` to separate keys and values
if metaformatdata is "toml".
2015-02-17 11:51:43 +01:00
Anthony Fok
82a0888995 Revert "Expansion of unit tests for utils/utils.go"
Rationale: Test failing on Windows with errors like this:

    utils_test.go:177: Error: Could not remove file "f".
    Error: remove C:\Users\appveyor\AppData\Local\Temp\utils_test_747965610:
    The process cannot access the file because it is being used by another
    process.

This reverts commit 6b28e38cea.

Sorry for my premature merge of Pull Request #818.
2015-02-17 03:35:23 -07:00
bep
c2e2913872 Fix canonifyurl vs schemaless links
And looks even faster:

Compared to previous attempt:

benchmark              old ns/op     new ns/op     delta
BenchmarkAbsUrl        30902         27206         -11.96%
BenchmarkXmlAbsUrl     15389         14216         -7.62%

benchmark              old allocs     new allocs     delta
BenchmarkAbsUrl        33             28             -15.15%
BenchmarkXmlAbsUrl     16             14             -12.50%

benchmark              old bytes     new bytes     delta
BenchmarkAbsUrl        4167          3504          -15.91%
BenchmarkXmlAbsUrl     2057          2048          -0.44%

Compared to before I started all of this:

benchmark              old ns/op     new ns/op     delta
BenchmarkAbsUrl        36219         27206         -24.88%
BenchmarkXmlAbsUrl     23903         14216         -40.53%

benchmark              old allocs     new allocs     delta
BenchmarkAbsUrl        60             28             -53.33%
BenchmarkXmlAbsUrl     30             14             -53.33%

benchmark              old bytes     new bytes     delta
BenchmarkAbsUrl        5842          3504          -40.02%
BenchmarkXmlAbsUrl     3754          2048          -45.44%

Fixes #816
2015-02-17 11:07:24 +01:00
Owen Waller
6b28e38cea Expansion of unit tests for utils/utils.go
This commit expands the test coverage for the utils/utils.go module.

The utils module uses the 'github.com/spf13/jwalterweatherman' (aka jww)
package for logging. The tests take the approach of examining the log
file that is produced by this module to verify correct behaviour. This
avoids refactoring the utils module.

The log file messages written by the jww module are of the form:
<log level>: yyyy/mm/dd <string|error message>

The checkLogFile function checks each of these parts in turn except for
the date string, which is currently ignored. The final part of the log
file format can either be a single error message, or a series of
strings followed by an error message. Both the error message and the
series of strings can be empty strings.

The log file is checked using a combination of the regex package,
along with the bufio scanner type. Each test logs to its own temporary
log file. This is achieved with standard test setup and teardown
functions.

One consequence of these tests is that StopOnErr has been refactored
into call a new unexported function doStopOnErr which contains the bulk
of the original logic. This allows the same testing approach to be used
with StopOnErr as with CheckErr and cutUsageMessage, rather than look at
the exit status code of the test itself.

An unfortunate side effect of this is that the author of the tests must
now know if a log file is expected or not. If doStopOnErr determines
that an empty error message would be written to the log file then
nothing is written. In the context of the tests this means that the log
file created by the test would have no contents. Consequently there
would be nothing for the test to examine. This situation is indicated by
the boolean flag logFileExoected in the testData struct, and processed
by the logFileIsExpectedAndValid function.

Although not ideal this was deemed a reasonable compromise.
2015-02-17 02:20:00 -07:00
Anthony Fok
cb9fa62743 [Docs] Minor copyediting of highlighting.md
Also add `apt-get` command for installing Pygments.
2015-02-17 01:59:40 -07:00
karland
bd0de85dbc Add information to highlighting with Pygments 2015-02-17 01:49:44 -07:00
karland
1827680bea List of variables
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
2015-02-17 01:28:20 -07:00
Maxime Michel
09ed3c4b92 Fixed a typo 2015-02-17 01:16:41 -07:00
Anthony Fok
54e417681d Make "Indexes" the alias and "Taxonomies" the canonical name
... rather than the other way around.
Discovered thanks to the new `hugo config` command.
2015-02-16 13:16:17 -07:00
spf13
d33a42f1d1 Merge branch 'master' of github.com:spf13/hugo 2015-02-16 11:51:32 -05:00
Anthony Fok
159836ed2d README.me: Add linefeed that got lost in the last commit 2015-02-16 09:07:52 -07:00
Anthony Fok
63e7b9705f [Docs] Add pointers to roadmap; new tweet and article 2015-02-16 09:02:56 -07:00
bep
f1fec88c30 Improve abs url replacement speed
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
2015-02-16 08:24:42 -05:00
bep
27c03a6dd0 Add benchmark for AbsUrlInXml
And a general test cleanup in /transform.

See #894
2015-02-16 08:24:42 -05:00
Ivan Fraixedes
366f991694 Another link in the same page 2015-02-14 18:35:37 -05:00
Ivan Fraixedes
b389a92383 Fixed invalid link to partials 2015-02-14 18:35:37 -05:00
Joseph Kaptur
462e666f45 Update docs so that figure includes the class parameter. 2015-02-14 18:35:00 -05:00
bep
c14e7b10d0 Add 'config' command to list site configuration
Fixes #871
2015-02-14 18:33:47 -05:00
spf13
d6f81c7346 Put back static theme conditional 2015-02-14 18:30:15 -05:00
Anthony Fok
d10e05f2e3 [commands/new.go] Update theme.toml etc.
- 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
2015-02-13 15:00:17 -07:00
bep
87975e04eb Remove nohup.out committed by accident 2015-02-12 14:32:04 +01:00
bep
4820683330 Doc Data Files: Add section about themes and expanded the example a bit 2015-02-12 09:09:35 +01:00
bep
1217632307 Remove now superfluous conditional 2015-02-12 00:09:04 +01:00
bep
8ed67169ed Fix broken data dir test 2015-02-11 21:55:11 +01:00
bep
8df59c8123 Temporarily disable broken test 2015-02-11 20:33:19 +01:00
bep
ebcc1e6699 Add data files support in themes
If duplicate keys, the main data dir wins.

Fixes #892
2015-02-11 20:24:56 +01:00
Anthony Fok
664fd99135 Change "ctrl+c" to "Ctrl+C" 2015-02-11 01:11:50 -07:00
midinastasurazz
dbb86679a1 Fix typo: GetJson -> GetCsv 2015-02-11 00:57:17 -07:00
Greg Restall
7e28db18f2 Add showcase entry for consequently.org
Consequently.org is a personal site for an academic, with a blog, list
of publications, classes and talks, all managed by hugo.
2015-02-11 00:31:44 -07:00
bep
fa71f6c11e Make # survice Url cleaning
To enable anchors in Urls.

Fixes #888
2015-02-10 19:14:19 +01:00
spf13
e3daa359ec Update release notes for v0.13 2015-02-10 10:58:20 -05:00
bep
22d85c2a18 Avoid converting summary to []byte and back to string 2015-02-10 14:37:29 +01:00
bep
371c148c34 Fix alias for data files doc 2015-02-09 16:58:12 +01:00
bep
03fff880ec Add docs for Data Files
Fixes #887
2015-02-09 16:52:52 +01:00
bep
6afe70d5da Better error message for data-file parsing errors 2015-02-09 16:07:30 +01:00
bep
1c50f775b5 DataDir: Minor polish and add missing tests
Also, now logs an ERROR on duplicate keys, instead of returning an error and make sure sub-folders take presedence in data dir.
2015-02-09 13:19:19 +01:00
Erlend Klakegg Bergheim
773812de6f Reads data files inside data/ and makes data available in .Site.Data
Fixes #476.

Conflicts:
	hugolib/site.go
2015-02-09 13:17:13 +01:00
Anthony Fok
4c7e119ca1 [Docs] Say which directory to clone the hugoThemes
On http://gohugo.io/overview/quickstart/, explicitly state
that hugoThemes is to be cloned from within the working directory,
like it is stated on http://gohugo.io/themes/installing/.

Fixes #886
2015-02-08 19:52:27 -07:00
Anthony Fok
088d46a804 parser.FormatSanitize() MetaDataFormat for date too
So that the date would come out correctly with
variations like `MetaDataFormat = "YAML"` in addition to
the normally expected `MetaDataFormat = "yaml"`.

Fixes #865.
2015-02-08 09:55:20 -07:00
bep
08219161dd Use buffer pool in StripHTML
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%
2015-02-06 15:35:45 +01:00
bep
5e34ae6199 Log ERROR on missing baseurl
Fixes #877
2015-02-06 10:39:54 +01:00
bep
43e48a8989 Add benchmark test for StripHTML
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%
2015-02-06 10:00:42 +01:00
bep
48b6777ea2 Fix Truncate
TruncateWordsToWholeSentence knows if the summary is truncated, so let "him" decide.

Fixes #880
2015-02-05 14:04:48 -07:00
bep
2bee4a1570 Replace 4 strings.Replace with 1 strings.Replacer
Consumes less memory, slightly faster.
2015-02-05 18:31:11 +01:00
bep
5df85770fc Add memprofile to pprof benchmark 2015-02-05 15:48:09 +01:00
bep
f8704c1bf2 Avoid calling strings.Fields multiple times with same content
This should be a relief for big sites.
2015-02-05 00:38:50 +01:00
bep
11a19e0760 Build PageMenus only once 2015-02-04 21:27:27 +01:00
Mary Anthony
df734bc18a Tighten README for the sloppy reader
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:
2015-02-01 23:15:46 -07:00
bep
8b95cab94c Avoid panic on unknown markup
Fixes #863
2015-02-01 22:30:57 +01:00