Commit graph

245 commits

Author SHA1 Message Date
Alexandre Bourget ec33732fbe Add multilingual support in Hugo
Implements:
* support to render:
  * content/post/whatever.en.md to /en/2015/12/22/whatever/index.html
  * content/post/whatever.fr.md to /fr/2015/12/22/whatever/index.html
* gets enabled when `Multilingual:` is specified in config.
* support having language switchers in templates, that know
  where the translated page is (with .Page.Translations)
  (when you're on /en/about/, you can have a "Francais" link pointing to
   /fr/a-propos/)
  * all translations are in the `.Page.Translations` map, including the current one.
* easily tweak themes to support Multilingual mode
* renders in a single swift, no need for two config files.

Adds a couple of variables useful for multilingual sites

Adds documentation (content/multilingual.md)

Added language prefixing for all URL generation/permalinking see in the
code base.

Implements i18n. Leverages the great github.com/nicksnyder/go-i18n lib.. thanks Nick.
* Adds "i18n" and "T" template functions..
2016-09-06 18:32:15 +03:00
Cameron Moore b6635e1baf helpers: Fix bug in emoji renderer
Fixes #2391
2016-08-30 00:34:48 +02:00
Mark D. Blackwell be429d2268 docs: Correct all erroneous swaps of "it's" and "its" 2016-08-18 20:42:40 +02:00
Bjørn Erik Pedersen 93f3a85bf8 Fix the time template func test
By making it not depend on the locale setup.
2016-08-04 10:36:44 +02:00
Bjørn Erik Pedersen b426c20e14 Return specific error on walk path too short 2016-07-30 22:32:03 +02:00
Bjørn Erik Pedersen 15b6693541 Adjust the sanity check to path length 4 2016-07-30 20:07:35 +02:00
Bjørn Erik Pedersen 94d998989d Add sanity check to the file walker
As more tests now hit the virtual filesystem, add this check
to prevent any walking of the entire file system.
2016-07-30 19:54:07 +02:00
Bjørn Erik Pedersen 5f5fccbc36 Do not return empty theme dirs
This prevents reading data etc. from the root.

Fixes #2320
2016-07-30 16:21:57 +02:00
Bjørn Erik Pedersen 9489272681 Handle errors during filesystem walk
Fixes #2318
2016-07-30 14:03:38 +02:00
Bjørn Erik Pedersen 91b61b976d Simplify the configuration of HugoHTMLRenderer 2016-07-22 11:00:52 +02:00
Mathias Biilmann 330639d2ae Fix panic when using URLize
Using URLize on a string like '100%-true' would cause a panic
2016-07-11 10:06:40 +02:00
Bjørn Erik Pedersen d44bb4ec05 Revert "Use bufferpool in Asciidoc handler"
This reverts commit 068a77151e.

This was hasty. We would need to create a copy to use the pool in this case.
2016-07-10 19:42:14 +02:00
Bjørn Erik Pedersen 7c125ebb7d Revert "Use bufferpool in Rst handler"
This reverts commit d9bc233f1f.

This was hasty. We would need to make a copy to use the pool in this case.
2016-07-10 19:41:16 +02:00
Bjørn Erik Pedersen d9bc233f1f Use bufferpool in Rst handler 2016-07-10 12:54:15 +02:00
Bjørn Erik Pedersen 00d70e5569 Remove []byte to string to []byte conversion in Rst 2016-07-10 12:52:20 +02:00
Bjørn Erik Pedersen 068a77151e Use bufferpool in Asciidoc handler 2016-07-10 12:31:31 +02:00
Bjørn Erik Pedersen ed5ad12af3 Remove []byte to string to []byte conversion in Asciidoc 2016-07-10 12:28:34 +02:00
Bjørn Erik Pedersen 1d7f4413f5 Consolidate the Render funcs 2016-07-10 11:36:25 +02:00
Bjørn Erik Pedersen e6d97c4fca Add Rst shortcode test
Fixes #2253
2016-07-04 10:49:20 +02:00
Bjørn Erik Pedersen 5388211c11 Add Asciidoc shortcode test
Fixes #2249
2016-07-04 00:33:08 +02:00
Bjørn Erik Pedersen 6c0f705217 Fix Emoji benchmark
The Emoji implementations gives slightly different output. One of them pads with a space.
2016-07-01 17:59:39 +02:00
Bjørn Erik Pedersen aa66478c20 Add Emoji test case
See #2246
2016-07-01 17:06:13 +02:00
Cameron Moore e2aea65170 helpers: Remove ToReader funcs
Remove StringToReader and BytesToReader in favor of using the stdlib directly.
2016-06-25 17:57:05 -05:00
Bjørn Erik Pedersen 34f40044d7 Fix shortcode in markdown headers
This issue was introduced as a fix to shortcode not working in RST.

One could argue that Blackfriday and friends should handle `#` in titles, but that will be a discussion
for another day.

The new placeholder pattern should be RST safe and work with titles.

And now with a test so this doesn't break again.

Fixes #2192
Fixes #2209
Closes #2210
2016-06-15 09:12:07 +02:00
Bjørn Erik Pedersen 2564f46a68 Fix Emojfy for certain text patterns
Fixes #2198
2016-06-11 20:40:56 +02:00
Steve Francia f9cadee8de Bump version to 0.17-DEV 2016-06-06 09:10:55 -04:00
Steve Francia 26c18005a2 Remove HugoVersionSuffix "-DEV" prior to 0.16 release 2016-06-03 11:51:45 -04:00
Bjørn Erik Pedersen 26906d8569 Don't add any space around Emojis 2016-05-09 22:59:49 +02:00
Cameron Moore e4ee1b89ad helpers: Use net/url for URL parsing in AbsURL
Fixes #2112
2016-04-27 10:29:46 -05:00
Bjørn Erik Pedersen 06772eefcd Default to plainIDAnchors
Fixes #2057
2016-04-12 18:34:46 +02:00
Bjørn Erik Pedersen 39c9ae3108 Revert "Use Node.ID for anchor ID"
This reverts commit cd558958a0.
2016-04-12 18:11:24 +02:00
Bjørn Erik Pedersen cd558958a0 Use Node.ID for anchor ID
Fixes #2057
2016-04-11 13:17:25 +02:00
Robert Basic 37fb2d43e5 helpers: Ignore cache for Pygments when flag set
When the --ignoreCache flag is set to true, do not write and read
the Pygments results to/from the cache directory.

Fixes #2066
Closes #2068
2016-04-10 20:55:57 +02:00
Sven Dowideit 1648e327c0 Document and clean SourceRelativeLinksEval code 2016-04-07 20:10:38 +02:00
Philipp Oppermann 43b5dfabb5 Disable syntax guessing for PygmentsCodeFences by default
This disables highlighting for fenced code blocks without explicitly specified language. It also introduces a new `PygmentsCodeFencesGuessSyntax` config option (defaulting to false).

To enable syntax guessing again, add the following to your config file: `PygmentsCodeFencesGuessSyntax = true`

This is a breaking change.
2016-04-04 22:19:36 +02:00
Bjørn Erik Pedersen 4f66f790b1 Add readFile template func
This also includes a refactor of the hugofs package and its usage.

The motivation for that is:

The Afero filesystems are brilliant. Hugo's way of adding a dozen of global variables for the different filesystems was a mistake. In readFile (and also in some other places in Hugo today) we need a way to restrict the access inside the working dir. We could use ioutil.ReadFile and implement the path checking, checking the base path and the dots ("..") etc. But it is obviously better to use an Afero BasePathFs combined witha ReadOnlyFs. We could create a use-once-filesystem and handle the initialization ourselves, but since this is also useful to others and the initialization depends on some other global state (which would mean to create a new file system on every invocation), we might as well do it properly and encapsulate the predefined set of filesystems. This change also leads the way, if needed, to encapsulate the file systems in a struct, making it possible to have several file system sets in action at once (parallel multilanguage site building? With Moore's law and all...)

Fixes #1551
2016-03-31 21:24:18 +02:00
Bjørn Erik Pedersen dbfc7ea024 Fix error handling in SymbolicWalk 2016-03-25 18:18:39 +01:00
Bjørn Erik Pedersen bfe8009415 helpers: Fix SymbolicWalk for the root folder
handle the root folders themselves.

This commit fixes that.

Fixes #2018
2016-03-25 12:49:23 +01:00
digitalcraftsman 5d3705df16 helpers: Apply GoLint rules 2016-03-24 23:16:18 +01:00
Bjørn Erik Pedersen 3e77886aad helpers: Fix GoDoc in Hugo version constants 2016-03-24 14:27:36 +01:00
Bjørn Erik Pedersen 8a60571fd2 helpers: Fix and add Godoc in path* 2016-03-23 10:03:29 +01:00
Bjørn Erik Pedersen 6ff2e1dbe7 helpers: Remove the else in MakePathSanitized 2016-03-23 09:45:18 +01:00
Bjørn Erik Pedersen 4f00f1c94f heloers: Add a linefeed to make Golint happy 2016-03-23 00:07:44 +01:00
Bjørn Erik Pedersen b0e21f967b helpers: Silence some Golint warnings 2016-03-22 23:53:19 +01:00
Bjørn Erik Pedersen b9127ecca6 helpers: Apply gofmt 2016-03-22 19:43:03 +01:00
Bjørn Erik Pedersen e5aa477491 Add support for symbolic links for content, layout, static, theme
Note: This is for the content roots only, but that should satisfy most needs.

Fixes #1855
2016-03-21 19:13:29 -04:00
Aditya Bhargava c42982f76b Add '+' as one of the valid characters in urls specified in the front matter
Fixes #1290
2016-03-21 18:48:50 -04:00
Anthony Fok d45b55bdd4 helpers: Rename getMmarkHtmlRenderer to getMmarkHTMLRenderer
To be consistent with the changes made in commit 67df33f, see #959.
2016-03-21 15:17:37 +08:00
Anthony Fok 2c5e4f7640 helpers: Support EXTENSION_BACKSLASH_LINE_BREAK for Blackfriday
Exposed as "backslashLineBreak" and enabled by default
as upstream have done.

Fixes #1935
2016-03-20 04:21:16 +08:00
Anthony Fok 4c4ce55217 helpers: Fix minor typo in content_test.go 2016-03-20 04:12:53 +08:00