Commit graph

1371 commits

Author SHA1 Message Date
Michael Henderson 0ab345236d Updates documentation with instructions for a Mac
Adds step-by-step instructions for installing from both brew and
the official tarball. Not sure if steps for installing from source
belong here, so left them out.

Fixes #1005
2015-03-30 16:54:38 +02:00
sainaen 6a539db58e Update embedded rss.xml code in the docs 2015-03-30 16:50:44 +02:00
bep be21e2cbed Add some more corner tests for ReaderContains 2015-03-30 01:22:09 +02:00
bep be1429fa88 Fix shortcode handling in ToC
Fixes #1010
2015-03-29 22:27:21 +02:00
bep be6696c34b Handle views in combo with Ace base templates
As views looks like a regular template, but doesn't need a base template, we have to look inside it.

Altough really not needed by this commit, reading the full file content into memory just to do a substring search is a waste.
So this commit implements a `ReaderContains` func that in most cases should be much faster than doing an `ioutil.ReadAll` and `bytes.Contains`:

```
benchmark                   old ns/op     new ns/op     delta
BenchmarkReaderContains     78452         20260         -74.18%

benchmark                   old allocs     new allocs     delta
BenchmarkReaderContains     46             20             -56.52%

benchmark                   old bytes     new bytes     delta
BenchmarkReaderContains     46496         1258          -97.29%
```

Fixes #999
2015-03-29 21:12:13 +02:00
Ruben Vermeersch e8ca8602c0 Hash all pygments parameters.
Ensures that Hugo rehighlights source code whenever one of the
highlighting options changes.
2015-03-29 13:01:44 +02:00
bep beaf5db3ff Use helpers.FilePathSeparator const 2015-03-28 21:46:06 +01:00
Nuno Antunes 61a02c4df8 Fix section name guessing on Windows 2015-03-28 21:43:55 +01:00
Ruben Vermeersch 15463d3d45 Cache pygments rendering between runs
Fixes #1000
2015-03-27 19:50:48 +01:00
bep be8c067577 Add support for Ace base and inner templates
Fixes #994
Fixes #511
2015-03-26 17:22:35 +01:00
Anthony Fok 0921761e47 Add missing ".adoc" extension in handler_page.go
Commit 358dcce supposedly added ".adoc" extension recognition
for AsciiDoc, but one place was missed.

Thanks to @sjfloat for reporting the bug!
See discussions at #470.
2015-03-24 20:27:06 -06:00
bep be84f93716 Change to variadic int args in Slicestr
Makes for a better template api.
2015-03-23 19:17:55 +01:00
Anthony Fok 5b0245ca59 Implement substr template function
Its behavior is similar to that in JavaScript
with special handling of negative length as found in in PHP.

Fixes #991
2015-03-23 18:56:58 +01:00
bep beb423a2d9 Rename Slice to Slicestr
Fixes #990
2015-03-23 16:24:15 +01:00
bep be82b5a94f Polish Slice doc 2015-03-23 12:42:54 +01:00
bep be19f4eb91 Rename Substr to Slice
That is whas was implemented, not Substr.

Also make the API more similar to Go's internal slice by making both the start and end indices optional.

See #990
2015-03-23 12:18:27 +01:00
bep be4fe8f8af Polish Substr and Split tests 2015-03-22 13:52:22 +01:00
Xin Fan 04817c7b83 Add Substr and Split template functions
Both of these can take any type the cast lib can turn into a string.
2015-03-22 13:24:47 +01:00
bep 9cc3d67c57 Pull Data Files tests into its own file 2015-03-19 17:23:14 +01:00
bep 1e8e5d4e7a Format docs 2015-03-19 02:09:42 +01:00
bep 66cf3bdc77 Rename interface contentRewriter to contentTransformer
Is is a much better name.
2015-03-19 02:07:57 +01:00
bep efb564775a Change safeHTtml to safeHTML in sitemap template 2015-03-18 21:27:29 +01:00
bep a8bfaba081 template: add some missing test cases for First 2015-03-18 20:47:10 +01:00
bep b15d0a168f transform: remove some superfluous int conversions 2015-03-18 20:18:18 +01:00
bep 658cfb287e Remove URL param from exported AbsURL methods
This is to make it clear that there is only one URL in play,
the BaseURL.
2015-03-18 20:03:34 +01:00
bep e7099cfa26 Un-export ContentReWriter 2015-03-18 17:33:12 +01:00
bep 98ee69bce2 Write to rotating ContentReWriter in transformer chain
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%
2015-03-18 17:05:54 +01:00
bep 9688ed2585 Comment out shaky Seq test 2015-03-18 12:42:00 +01:00
bep f4244be036 Calculate the next Hugo version in Deprecated
Deprecation will be an ongoing activity for many future versions.
2015-03-18 12:27:56 +01:00
bep 3273fce044 Refactor Hugo version
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.
2015-03-18 12:23:13 +01:00
bep 49f20bbc9b Add UrlPath to the deprecated list 2015-03-18 11:30:37 +01:00
bep e39a258ec4 Improve type handling in Seq 2015-03-18 11:30:37 +01:00
Anthony Fok b3bd71fec9 Update Hugo docs with the initialisms suggested by golint
In particular:

 * .Url → .URL (for node, menu and paginator)
 * .Site.BaseUrl → .Site.BaseURL
 * getJson → getJSON
 * getCsv → getCSV
 * safeHtml → safeHTML
 * safeCss → safeCSS
 * safeUrl → safeURL

Continued effort in fixing #959.
2015-03-18 11:30:37 +01:00
Anthony Fok 8b8fb417ae More initialism corrections (golint)
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.
2015-03-18 11:30:37 +01:00
Anthony Fok ca69cad8aa Press: Add "Migrating to Hugo From Octopress" by Nathan LeClaire 2015-03-18 00:32:19 -06:00
Anthony Fok a220a3ba37 [Docs] Copyedit http://gohugo.io/extras/dynamiccontent/ 2015-03-17 23:53:17 -06:00
bep bcdad02c06 Use ReaderToString in site tests
Since a string is what's really needed.
2015-03-17 18:14:29 +01:00
bep e1340c060b Fix crossrefs on Windows
Have to convert path slashes to file path slashes before the URL path is compared to a file path.

Fixes #957
2015-03-17 16:29:10 +01:00
quoha a044734541 Add "getenv" as an wrapper for os.Getenv
Add a wrapper for the os.Getenv function. The
wrapper takes as input a string that is assumed to be an exported
variable name.

Fixes #977
2015-03-16 18:38:43 +01:00
Vitaly Haritonsky 32bf8b763c removed duplicate word in readme 2015-03-14 10:45:50 -06:00
bep 27ed49e532 Revert "Added image support to the sitemap.xml template"
This reverts commit 3c147bd419.

Fixes #972
2015-03-14 00:03:34 +01:00
Derek Perkins 3c147bd419 Added image support to the sitemap.xml template
Conflicts:
	tpl/template_embedded.go
2015-03-12 22:13:42 -04:00
bep 0be2aade99 Add Seq template func
Very similar to GNU's seq.

Fixes #552

Conflicts:
	tpl/template.go
2015-03-12 22:08:36 -04:00
Anthony Fok 358dcce7a6 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
2015-03-12 22:01:49 -04:00
bep fbcda03029 Do not ERROR-log missing /data dir
Fixes #930
2015-03-12 21:44:36 +01:00
bep b190ad0ff9 source: add some test cases for File 2015-03-12 20:50:44 +01:00
bep f8a840a14c Add double checking in Deprecated
To prevent possible duplicate log statements.
2015-03-12 18:51:31 +01:00
bep 6e30c10d09 Add deprecated logger 2015-03-12 16:10:34 +01:00
Anthony Fok f848dc92db [Docs] Update and expand http://gohugo.io/overview/usage/
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
2015-03-12 08:53:48 -06:00
Anthony Fok d3c0fde5be Update press coverage: Fix URL; new tutorial in Chinese 2015-03-12 08:50:31 -06:00