Commit graph

222 commits

Author SHA1 Message Date
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
Bjørn Erik Pedersen 0a768ec95f Simplify GetDottedRelativePath 2016-03-19 17:17:17 +01:00
Bjørn Erik Pedersen 8d86f1ec6e Return early from parseOptions 2016-03-19 17:12:10 +01:00
Bjørn Erik Pedersen 70739c972e Remove unnecessary type conversions 2016-03-14 20:35:50 +01:00
Bjørn Erik Pedersen 5d915e7e96 helpers: Unexport some internals 2016-03-14 17:27:15 +01:00
Bjørn Erik Pedersen 91ffc76b24 helpers: Remove unused code 2016-03-14 15:20:36 +01:00
Bjørn Erik Pedersen 542e220cc4 Make tests green on both Pygments 2.0.2 and 2.1.3
See #1969
2016-03-13 22:06:51 +01:00
Bjørn Erik Pedersen cafb784799 Add emoji support
This uses the Emoji map from https://github.com/kyokomi/emoji -- but with a custom replacement implementation.

The built-in are fine for most use cases, but in Hugo we do care about pure speed.

The benchmarks below are skewed in Hugo's direction as the source and result is a byte slice,
Kyokomi's implementation works best with strings.

Curious: The easy-to-use `strings.Replacer` is also plenty fast.

```
BenchmarkEmojiKyokomiFprint-4  	   20000	     86038 ns/op	   33960 B/op	     117 allocs/op
BenchmarkEmojiKyokomiSprint-4  	   20000	     83252 ns/op	   38232 B/op	     122 allocs/op
BenchmarkEmojiStringsReplacer-4	  100000	     21092 ns/op	   17248 B/op	      25 allocs/op
BenchmarkHugoEmoji-4           	  500000	      5728 ns/op	     624 B/op	      13 allocs/op
```

Fixes #1891
2016-03-11 15:51:37 -06:00
Marek Janda 0962470850 Make absURL properly handle baseURL with path component 2016-03-10 11:08:50 +01:00
Bjørn Erik Pedersen a2abad9677 Add support for Go 1.6 block keyword in templates
NOTE: Needs Go 1.6 to use the new feature.

Fixes #1832
2016-03-10 10:53:54 +01:00
Bjørn Erik Pedersen 5b065a27a2 Some missing shortcode replacements
See #1904
2016-03-01 13:51:46 +01:00
Bjørn Erik Pedersen 7f682d7802 Fix shortcode handling in RST
Fixes #1904
2016-03-01 11:04:25 +01:00
Gergely Brautigam e95f3af933 helpers: Test coverage increase
Started to increase coverage in helpers package, now at 74.9% of statements.

In the process, also a few minor changes have been applied to content.go.

* Content.go has undergone a formatting refactor regarding comments
* Unused function TruncateWords has been removed
* RenderingContext's "mmark" has been changed to use MmarkRender
* Content_test.go added to cover content.go's functionality
2016-02-06 14:27:11 +01:00
Bjørn Erik Pedersen 318a984526 Apply gofmt -s 2016-02-06 13:09:52 +01:00
Bjørn Erik Pedersen 5def6d9aee Make the watch logger less chatty 2016-01-28 15:33:41 +01:00
Bjørn Erik Pedersen 3054a46185 Make the DistinctErrorLogger more generic 2016-01-28 15:33:41 +01:00
Ben Thomas 26d23f7f4b added remaining relevant options 2016-01-04 11:52:40 -05:00
Ben Thomas e904ccffb6 added more pygments opts 2016-01-04 11:52:40 -05:00
John McFarlane b1f2b433bc Fix /.xml RSSLink when uglyurls are enabled
Prior to this commit the root url with uglyurls enabled is "/.xml".
This commit relates to #175.
2016-01-04 11:25:37 -05:00
Sven Dowideit 0f6b334b67 Source file based relative linking
ala GitHub repository markdown for both md files and non-md files

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-01-01 15:23:11 -05:00
digitalcraftsman 47587321d9 Add themesDir option to configuration
themesDir can be used to change the default
path of the themes folder.

Fixes 1556
2016-01-01 14:46:40 -05:00
Daniel TISCHER 40fccf2251 Fixes #1292 2016-01-01 14:35:58 -05:00
Anthony Fok de82404d35 Fix hugo server "Watching for changes" path display
especially when the given `--source` path is a relative directory.

Also, when `--source` is specified, make WorkingDir an absolute path
from the very beginning, to be consistent with the case when `--source`
is not given.  Otherwise, the function name helpers.AbsPathify(), which
prepends WorkingDir to a relative path, does not really make sense.

Fixes #1721
2015-12-19 05:19:31 -07:00
Anthony Fok 8509727fe8 Add copyright header to that source files that don’t have one.
See #1646
2015-12-10 15:19:38 -07:00