Commit graph

585 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
a58741a172 helpers: Fix broken test 2017-10-04 09:27:15 +02:00
Cameron Moore
47fdfd5196 Clean up lint in various packages
Changes fall into one of the following:

- gofmt -s
- receiver name is inconsistent
- omit unused 2nd value from range
- godoc comment formed incorrectly
- err assigned and not used
- if block ends with a return statement followed by else
2017-09-29 16:23:16 +02:00
Bjørn Erik Pedersen
d45e358a05 helpers: Fix broken Chroma test 2017-09-29 10:40:56 +02:00
Brendan Roy
8717a60cc0 Change SummaryLength to be configurable (#3924)
Move SummaryLength into the ContentSpec struct and refactor the
relevant summary functions to be methods of ContentSpec. The new
summaryLength struct member is configurable by the summaryLength config
value, and the default remains 70. Also updates hugolib/page to use the
refactored methods.

Resolves #3734
2017-09-29 09:04:55 +02:00
hugoreleaser
f806e951fd releaser: Prepare repository for 0.30-DEV
[ci skip]
2017-09-26 19:24:34 +00:00
hugoreleaser
396759a09b releaser: Bump versions for release of 0.29
[ci skip]
2017-09-26 19:23:15 +00:00
hugoreleaser
404e2994e5 releaser: Prepare repository for 0.29-DEV
[ci skip]
2017-09-25 08:00:38 +00:00
hugoreleaser
9e850c1f64 releaser: Bump versions for release of 0.28
[ci skip]
2017-09-25 07:59:12 +00:00
Bjørn Erik Pedersen
fb33d8286d Use Chroma as new default syntax highlighter
If you want to use Pygments, set `pygmentsUseClassic=true` in your site config.

Fixes #3888
2017-09-25 08:59:02 +02:00
hugoreleaser
5c3b210368 releaser: Prepare repository for 0.28-DEV
[ci skip]
2017-09-13 13:13:28 +02:00
hugoreleaser
18126434f1 releaser: Bump versions for release of 0.27.1
[ci skip]
2017-09-13 11:03:59 +00:00
hugoreleaser
0375cbd025 releaser: Prepare repository for 0.28-DEV
[ci skip]
2017-09-11 05:33:02 +00:00
hugoreleaser
828eb70fa6 releaser: Bump versions for release of 0.27
[ci skip]
2017-09-11 05:32:02 +00:00
Bjørn Erik Pedersen
d2249c5099 Set up Hugo release flow on CircleCI
This rewrites the release logic to use CircleCI 2.0 and its approve workflow in combination with the state of the release notes to determine what to do next.

Fixes #3779
2017-09-10 17:14:02 +02:00
Daniel Karlsson
c8257f8b72 Render task list item inside label for correct accessibility
Fixes #3303
2017-08-09 20:09:43 +02:00
Bjørn Erik Pedersen
40d7d3baa8 releaser: Prepare repository for 0.27-DEV
[ci skip]
2017-08-07 09:13:50 +02:00
Bjørn Erik Pedersen
b36f6e31e0 releaser: Bump versions for release of 0.26
[ci skip]
2017-08-07 09:05:07 +02:00
Bjørn Erik Pedersen
f768c27f0d helpers: Remove some unused funcs 2017-08-03 15:59:10 +02:00
Jorin Vogel
81c13171a9 Add some missing doc comments
As pointed out by the linter, some exported functions and types are
missing doc comments.
The linter warnings have been reduced from 194 to 116.
Not all missing comments have been added in this commit though.
2017-08-03 15:57:51 +02:00
Bjørn Erik Pedersen
9891c0fb0e Remove sourceRelativeLinks
Fixes #3766
2017-08-02 22:04:38 +02:00
Abdullah Diab
481924b34d helpers: Fix broken TaskList in Markdown
As per the referenced issue, if the task list in Markdown has
nothing before it, it will be rendered wrongly:

```
---
title: "My First Post"
date: 2017-07-29T20:21:57+02:00
draft: true
---

* [ ] TaskList

```

is rendered as:

```
<ul> class="task-list"
<li><input type="checkbox" disabled class="task-list-item"> TaskList</li>
</ul>
```

The problem lies in the `List` function of `HugoHTMLRenderer`, it had
a hardocded index of `4` for the first `>` of the list, it is used to
insert the class into the text before the closing bracket, but that
hardcoded index is only right when there is a newline before the
opening bracket, which is the case when there is anything in the
document before the task list, but if there is nothing, then there is
no newline, and the correct index of the first `>` will be `3`.

To fix that we're changing the hardcoded index to be dynamic by using
`bytes.Index` to find it properly. We're also adding a test case to
make sure this is tested against.

Fixes #3710
2017-08-02 00:33:37 +02:00
Bjørn Erik Pedersen
8fb594bfb0 Make the title case style guide configurable
This works for the `title` func and the other places where Hugo makes title case.

* AP style (new default)
* Chicago style
* Go style (what we have today)

Fixes #989
2017-07-31 22:16:46 +02:00
Bjørn Erik Pedersen
cb9dfc2613 helpers: Add support for French Guillemets
Fixes #3725
2017-07-29 10:10:40 +02:00
Vasyl Solovei
b60aa1a504 helpers: Add --trace to asciidoctor args
This will help to understand and fix errors by
seeing stacktrace of an error.

See #3714
2017-07-21 03:07:56 -06:00
Bjørn Erik Pedersen
91f410ea90 Bump versions to 0.26-DEV 2017-07-10 09:16:02 +02:00
Bjørn Erik Pedersen
aded65b71d releaser: Prepare repository for 0.25-DEV
[ci skip]
2017-07-10 09:02:20 +02:00
Bjørn Erik Pedersen
0e09be7b3c releaser: Bump versions for release of 0.25.1
[ci skip]
2017-07-10 08:57:34 +02:00
Bjørn Erik Pedersen
1e19a98451 releaser: Prepare repository for 0.26-DEV
[ci skip]
2017-07-07 09:34:13 +02:00
Bjørn Erik Pedersen
6e086e3d03 releaser: Bump versions for release of 0.25
[ci skip]
2017-07-07 09:23:54 +02:00
Bjørn Erik Pedersen
5f831a6223 releaser: Replace the magic version handling
Take the new version as a string value.
2017-07-05 14:27:43 +02:00
Bjørn Erik Pedersen
a1d260b41a hugolib: Extend the sections API
This commit adds some section related methods that have been asked for:

* .CurrentSection
* .IsDescendant
* .IsAncestor

Fixes #3591
2017-07-04 09:11:49 +02:00
Haishan Zhou
a54404968a helpers: Add Blackfriday 'joinLines' extension support (#3574)
See https://github.com/russross/blackfriday/pull/334
"add an extension to handle Chinese (or CJK) newlines"
for more information.
2017-06-27 04:56:50 -06:00
Frank Braun
bfce30d859 helpers: add --initial-header-level=2 to rst2html (#3528)
reStructuredText doesn't have explicit section levels but sets them in
the order of appearance. Since level 1 is already set from the title in
the front matter it makes more sense to start with level 2 when
converting with rst2html.
2017-06-27 04:26:33 -06:00
Bjørn Erik Pedersen
3554fd1218 releaser: Prepare repository for 0.25-DEV
[ci skip]
2017-06-21 13:58:01 +02:00
Bjørn Erik Pedersen
8f69fe57a4 releaser: Bump versions for release of 0.24
[ci skip]
2017-06-21 13:52:27 +02:00
Bjørn Erik Pedersen
19f2e72913 Support non-md files as archetype files
It now properly uses the extension of the target file to determine archetype file.

Fixes #3597
Fixes #3618
2017-06-20 13:41:48 +02:00
Bjørn Erik Pedersen
662e12f348 commands, create: Add .Site to the archetype templates
This commit completes the "The Revival of the Archetypes!"

If `.Site` is used in the arcetype template, the site is built and added to the template context.

Note that this may be potentially time consuming for big sites.

A more complete example would then be for the section `newsletter` and the archetype file `archetypes/newsletter.md`:

```
---
title: "{{ replace .TranslationBaseName "-" " " | title }}"
date: {{ .Date }}
tags:
- x
categories:
- x
draft: true
---

<!--more-->

{{ range first 10 ( where .Site.RegularPages "Type" "cool" ) }}
* {{ .Title }}
{{ end }}
```

And then create a new post with:

```bash
hugo new newsletter/the-latest-cool.stuff.md
```

**Hot Tip:** If you set the `newContentEditor` configuration variable to an editor on your `PATH`, the newly created article will be opened.

The above _newsletter type archetype_ illustrates the possibilities: The full Hugo `.Site` and all of Hugo's template funcs can be used in the archetype file.

Fixes #1629
2017-06-19 10:47:00 +02:00
Bjørn Erik Pedersen
deffb4c3d9 releaser: Prepare repository for 0.24-DEV
[ci skip]
2017-06-16 09:52:02 +02:00
Bjørn Erik Pedersen
b502b9d8cc releaser: Bump versions for release of 0.23
[ci skip]
2017-06-16 09:41:39 +02:00
Bjørn Erik Pedersen
873a6f1885 Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
Bjørn Erik Pedersen
d8717cd4c7 all: Update import paths to gohugoio/hugo 2017-06-13 18:42:45 +02:00
Bjørn Erik Pedersen
2aafb24766 Revert "releaser: Bump versions for release of 0.22.1"
This reverts commit dce70fb7c5.
2017-06-13 14:26:56 +02:00
Bjørn Erik Pedersen
4bd5ce7ef3 releaser: Prepare repository for 0.23-DEV 2017-06-13 14:25:19 +02:00
Bjørn Erik Pedersen
0f78dd06a4 releaser: Prepare repository for 0.22.1-DEV
[ci skip]
2017-06-13 14:22:14 +02:00
Bjørn Erik Pedersen
dce70fb7c5 releaser: Bump versions for release of 0.22.1
[ci skip]
2017-06-13 14:17:15 +02:00
Bjørn Erik Pedersen
8ca586a6e5 releaser: Prepare repository for 0.23-DEV
[ci skip]
2017-06-12 09:07:46 +02:00
Bjørn Erik Pedersen
21cf464c1f releaser: Bump versions for release of 0.22
[ci skip]
2017-06-12 09:01:59 +02:00
Bjørn Erik Pedersen
8ddc7a5cde releaser: Prepare repository for 0.22-DEV
[ci skip]
2017-05-22 16:18:26 +03:00
Bjørn Erik Pedersen
1a965e5d2f releaser: Bump versions for release of 0.21
[ci skip]
2017-05-22 16:09:42 +03:00
Albert Nigmatzianov
7d39990497 helpers: Don't clean the path before Join
Join will call Clean anyway.
2017-05-09 14:07:43 +02:00
Albert Nigmatzianov
9b080dc625 helpers: Don't clean path twice
Join calls Clean as it says in docs.

Minor performance improvement:
Before:
Average time per operation: 432ms
Average memory allocated per operation: 127322kB
Average allocations per operation: 2138137

After:
Average time per operation: 428ms
Average memory allocated per operation: 127350kB
Average allocations per operation: 2137892
2017-05-07 17:16:36 +02:00
Cameron Moore
de7c32a1a8 tpl: Add template function namespaces
This commit moves almost all of the template functions into separate
packages under tpl/ and adds a namespace framework.  All changes should
be backward compatible for end users, as all existing function names in
the template funcMap are left intact.

Seq and DoArithmatic have been moved out of the helpers package and into
template namespaces.

Most of the tests involved have been refactored, and many new tests have
been written.  There's still work to do, but this is a big improvement.

I got a little overzealous and added some new functions along the way:

- strings.Contains
- strings.ContainsAny
- strings.HasSuffix
- strings.TrimPrefix
- strings.TrimSuffix

Documentation is forthcoming.

Fixes #3042
2017-04-30 10:56:38 +02:00
Bjørn Erik Pedersen
7f6430d84d Automate the Hugo release process
This commit adds a work flow aroung GoReleaser to get the Hugo release process automated and more uniform:

* It can be run fully automated or in two steps to allow for manual edits of the relase notes.
* It supports both patch and full releases.
* It fetches author, issue, repo info. etc. for the release notes from GitHub.
* The file names produced are mainly the same as before, but we no use tar.gz as archive for all Unix versions.
* There isn't a fully automated CI setup in place yet, but the release tag is marked in the commit message with "[ci deploy]"

Fixes #3358
2017-04-24 11:08:56 +02:00
Albert Nigmatzianov
6498d73c08 helpers: Delete RenderingContext.getConfig 2017-04-22 22:40:20 +02:00
Bjørn Erik Pedersen
5e2e62d97f Get versions back to 0.20-DEV
This reverts commit 8ac1fcd0ce.
2017-04-13 16:19:50 +02:00
Bjørn Erik Pedersen
8ac1fcd0ce Prepare release 0.20.1 2017-04-13 16:00:30 +02:00
Bjørn Erik Pedersen
4c6fec56f1 all Bump to 0.21-DEV 2017-04-10 09:33:21 +02:00
Bjørn Erik Pedersen
dac0d4a69d all: Prepare Hugo 0.20 release version 2017-04-10 09:10:53 +02:00
Albert Nigmatzianov
8f09e5f6bc helpers: Add new properties to ContentSpec 2017-04-06 21:02:37 +02:00
Bjørn Erik Pedersen
04d80e6e87 commands, helpers: Add correct verbose log level to the global loggers
We still use those in some cases.
2017-04-04 15:12:30 +02:00
Bjørn Erik Pedersen
87b3cd4655 hugolib, helpers: Reduce log level to WARN on .Render for non-regular pages
We will eventually support all types in the Render method.
2017-03-29 08:08:45 +02:00
Bjørn Erik Pedersen
5989c4d464 helpers, output: Fix spelling 2017-03-28 01:19:46 +02:00
Bjørn Erik Pedersen
09c88e84d1 output: Rename HTMLType etc. to HTMLFormat 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen
24c1770288 hugolib: Revise paginator alias path handling 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen
ee75e2999b Remove the now superflous defaultExtension
And some other unsed fields and methods.
2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen
15b64d51da all: Propagate baseURL error to the callers 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen
d851d6b98f Add custom protocol support in Permalink 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen
baa29f6534 output: Rework the base template logic
Extract the logic to a testable function and add support for custom output types.

Fixes #2995
2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen
6bf010fed4 hugolib: Refactor/-work the permalink/target path logic
This is a pretty fundamental change in Hugo, but absolutely needed if we should have any hope of getting "multiple outputs" done.

This commit's goal is to say:

* Every file target path is created by `createTargetPath`, i.e. one function for all.
* That function takes every page and site parameter into account, to avoid fragile string parsing to uglify etc. later on.
* The path creation logic has full test coverage.
* All permalinks, paginator URLs etc. are then built on top of that same logic.

Fixes #1252
Fixes #2110
Closes #2374
Fixes #1885
Fixes #3102
Fixes #3179
Fixes #1641
Fixes #1989
2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen
6eddb3e587 Revert "helpers: Add a Debug method to DistinctLogger"
Not needed.

This reverts commit 4382a8a6a0.
2017-03-19 10:24:12 +01:00
Bjørn Erik Pedersen
4382a8a6a0 helpers: Add a Debug method to DistinctLogger 2017-03-18 17:34:49 +01:00
Bjørn Erik Pedersen
7acec3c639 helpers: Return partially cleaned URL in case of error in URLPrep anyway
Closes #2987
2017-03-02 00:21:39 +01:00
Bjørn Erik Pedersen
577522bd45 helpers: Remove unused arg 2017-03-01 23:49:24 +01:00
Bjørn Erik Pedersen
3669015f56 Handle Hugo version strings with patch level
Fixes #3025
2017-03-01 15:49:07 +01:00
Bjørn Erik Pedersen
a0e3ff1645 helpers: Fix version string for Hugo 0.20 and similar
Fixes #3112
2017-03-01 14:34:40 +01:00
Bjørn Erik Pedersen
072cd00305 Bump version to 0.20-DEV 2017-02-27 13:58:50 +01:00
Bjørn Erik Pedersen
a1741f192c Update versions to 0.19 release 2017-02-27 10:49:35 +01:00
Chase Adams
86e8dd62f0 all: Add org-mode support
Fixes #1483 
See #936
2017-02-21 08:46:03 +01:00
Bjørn Erik Pedersen
93ca7c9e95 all: Refactor to nonglobal Viper, i18n etc.
This is a final rewrite that removes all the global state in Hugo, which also enables
the use if `t.Parallel` in tests.

Updates #2701
Fixes #3016
2017-02-17 17:15:26 +01:00
Bjørn Erik Pedersen
234273a5b5 Deprecate sourceRelativeLinks
Fixes #3028
Closes #3026
Closes #2891
Closes #2691
2017-02-11 16:51:22 +07:00
bogem
faba90ab96 helpers: Fix misspells 2017-02-04 22:28:36 +01:00
Bjørn Erik Pedersen
c71e1b106e all: Refactor to nonglobal file systems
Updates #2701
Fixes #2951
2017-02-04 11:37:25 +07:00
Bjørn Erik Pedersen
bc06135c96 helpers: Allow tilde in URLs
See #2177
2017-01-07 19:29:20 +01:00
Bjørn Erik Pedersen
001dd01ee2 helpers: Remove unusded WordCount 2017-01-05 00:00:00 +01:00
Anthony Fok
e3e5600b81 helpers: Fix minor typo in error message for Seq() 2017-01-04 00:57:28 -07:00
Bjørn Erik Pedersen
c344b1901f commands, helpers, vendor: Update to the latest jww logger
Updates #2701
2017-01-03 16:57:43 +01:00
bogem
2ac9817eae helpers: Add doc to Language.SetParam 2017-01-02 17:01:58 +01:00
bogem
4352156a27 commands, helpers: Fix docs 2017-01-02 17:01:58 +01:00
David Kassa
09a0af94f5 Fix Appveyor Windows build and GitInfo path issue on Windows 2017-01-01 23:16:58 +01:00
Bjørn Erik Pedersen
3e4fbbaae4 helpers: Add patch version
Fixes #2832
2016-12-26 14:03:50 +01:00
Cameron Moore
8b0c3b9b27 helpers: Remove "no theme set" warning
Fixes #2821
2016-12-23 19:48:50 +01:00
Bjørn Erik Pedersen
1e313ced3f Bump to 0.19-DEV 2016-12-19 23:14:10 +01:00
Bjørn Erik Pedersen
3d6fdb8ed3 Bump to 0.18 release version 2016-12-19 15:35:20 +01:00
Bjørn Erik Pedersen
a3a67163f9 hugolib: Enable override of theme base template only
This commit fixes the base template lookup order to match the behaviour of regular templates.

```
1. <current-path>/<template-name>-baseof.<suffix>, e.g. list-baseof.<suffix>.
2. <current-path>/baseof.<suffix>
3. _default/<template-name>-baseof.<suffix>, e.g. list-baseof.<suffix>.
4. _default/baseof.<suffix>

For each of the steps above, it will first look in the project, then, if theme is set,
in the theme's layouts folder.
```

Fixes #2783
2016-12-15 21:35:38 +01:00
Bjørn Erik Pedersen
c38bfda43b hugolib: Fix regressions with uglyURLs
Fixes #2734
2016-11-27 14:36:17 +01:00
Bjørn Erik Pedersen
65e5959bad helpers: Simplify 2016-11-23 18:54:57 +01:00
Bjørn Erik Pedersen
f1ed89fec4 Revise the deprecation strategy
Git users and theme authors two Hugo releases to fix:

1. With a visible warning
2. Then with an ERROR that exits with -1

Fixes #2726
2016-11-23 17:26:13 +01:00
bogem
c06c3234eb helpers: Fix typo in language.Get documentation 2016-11-23 10:51:33 +01:00
bogem
e81c06c3f0 helpers: Rename WalkRootTooShortError to ErrWalkRootTooShort
Fix golint warning: helpers/path.go:473:5: error var
WalkRootTooShortError should have name of the form ErrFoo

See #2014
2016-11-23 09:13:00 +01:00
bogem
647540d0ef helpers: Add documentation to some Language methods
See #2014
2016-11-23 09:13:00 +01:00
bogem
700d531a2c helpers: Use iterate operator by int in Emojify
Fix golint warning: helpers/emoji.go:56:4: should replace start += 1
with start++

See #2014
2016-11-23 09:13:00 +01:00
bogem
120f6b0cf2 all: Use jww instead of fmt for printing
This is an attempt to unify method for printing.
2016-11-22 22:06:48 +01:00
Albert Nigmatzianov
85a2d81e3c commands, tpl: Get rid of repeating viper accesses
* all: Delete some blank lines
* commands, tpl: Get rid of repeating viper accesses
2016-11-07 00:10:32 +01:00
Bjørn Erik Pedersen
d4830fc4fd helpers: Golint fixes 2016-11-05 17:28:14 +01:00
Albert Nigmatzianov
f21e2f25c9 all: Unify case of config variable names
All config variables starts with low-case and uses camelCase.

If there is abbreviation at the beginning of the name, the whole
abbreviation will be written in low-case.
If there is abbreviation at the end of the name, the
whole abbreviation will be written in upper-case.
For example, rssURI.
2016-10-24 20:56:00 +02:00
Bjørn Erik Pedersen
a10b2cd372 Avoid reading from Viper for path and URL funcs
The gain, given the "real sites benchmark" below, is obvious:

```
benchmark           old ns/op       new ns/op       delta
BenchmarkHugo-4     14497594101     13084156335     -9.75%

benchmark           old allocs     new allocs     delta
BenchmarkHugo-4     57404335       48282002       -15.89%

benchmark           old bytes       new bytes      delta
BenchmarkHugo-4     9933505624      9721984424     -2.13%
```

Fixes #2495
2016-10-24 13:45:30 +02:00
choeppler
ddf2a3407a Add page context to error logging in rendering
Add logging of the errors/warnings which rst2html outputs to its stderr
stream when rendering rst documents. Note that rst2html outputs warnings
and errors to stderr but it also adds them to the generated html. ->
hugo logs everything in stderr as error.

Add / complete adding page context (path to file being rendered) to
anything logged by getRstContent and getAsciidocContent.

See #2570
2016-10-19 15:22:40 +02:00
Bjørn Erik Pedersen
df943595a7 helpers: Slight improvement of ToLowerMap
See #2581
2016-10-16 22:49:56 +02:00
Bjørn Erik Pedersen
40b1b8f703 Fix case issue Viper vs Blackfriday config
There are still work to be done in the case department, but that will have to be another day.

Fixes #2581
See https://github.com/spf13/viper/issues/261
2016-10-16 19:28:21 +02:00
C. Hoeppler
766c82a6bb Add context to asciidoc/-tor error logging
Add DocumentName (path to the file being rendered) to RenderingContext
and use that information to include the path in the error print.

See #2399
Closes #2567
2016-10-13 13:48:43 +02:00
C. Hoeppler
9f9b93af2c Add logging of asciidoc/-tor errors
Add logging of the errors which asciidoc and asciidoctor output to their
stderr stream when converting asciidoc documents. Note that
asciidoctor's exit code may be SUCCESS even if there are ERROR messages
in its stderr output (tested with Asciidoctor 0.1.4 and 1.5.5).
Therefore log the stderr output whenever it is non-empty.

See #2399
2016-10-13 13:48:30 +02:00
Steve Francia
d54d6633ad release: version bump to v0.18-DEV 2016-10-07 11:11:43 -04:00
Steve Francia
5b9f488304 release: version bump to 0.17 2016-10-07 10:08:57 -04:00
Kim Gressens
fbce84450b Whitelist startinline pygments option 2016-10-06 14:59:49 +02:00
Bjørn Erik Pedersen
614dd2aa16 Deprecate PageMeta.WordCount etc.
Fix #2503
2016-09-28 11:05:21 +02:00
Bjørn Erik Pedersen
894b69dba5 Remove some unused vars 2016-09-19 22:14:15 +02:00
Bjørn Erik Pedersen
bacc1706cb helpers: Skip TestGetRealPath on Windows when not in CI
`os.Symlink` needs administrator rights on Windows,
and this seems to be the simplest fix while still getting the tests run on Appveyor.

Fixes #2476
2016-09-18 22:04:32 +02:00
Bjørn Erik Pedersen
98c12b7b3d Fail early in TestGetRealPath
See #2476
2016-09-18 19:52:42 +02:00
Bjørn Erik Pedersen
b86a605bfb Make paginate settings configurable per language
Fixes #2449
2016-09-15 09:32:52 +02:00
Bjørn Erik Pedersen
dd45e6d7e5 Lazy calculate WordCount, ReadingTime and FuzzyWordCount
This avoids having to execute these expensive operations for sites not using these values.

This commit sums up a set of wordcounting and autosummary related performance improvements.

The effect of these kind of depends on what features your site use, but a benchmark from 4 Hugo sites in the wild shows promise:

```
benchmark           old ns/op       new ns/op       delta
BenchmarkHugo-4     21293005843     20032857342     -5.92%

benchmark           old allocs     new allocs     delta
BenchmarkHugo-4     65290922       65186032       -0.16%

benchmark           old bytes      new bytes      delta
BenchmarkHugo-4     9771213416     9681866464     -0.91%
```

Closes #2378
2016-09-14 10:57:39 +02:00
Bjørn Erik Pedersen
4abaec5c04 Improve TotalWords counter func
It is obviously more efficient when we do not care about the actual words.

```
BenchmarkTotalWords-4            100000         18795 ns/op           0 B/op           0 allocs/op
BenchmarkTotalWordsOld-4          30000         46751 ns/op        6400 B/op           1 allocs/op
```
2016-09-14 10:50:56 +02:00
Bjørn Erik Pedersen
bcd434794a Avoid splitting words for summary
For people using autogenerated summaries, this is one of the hot spots in the memory department.

We don't need to split al the content into words to do proper summary truncation.

This is obviously more effective:

```
BenchmarkTestTruncateWordsToWholeSentence-4            300000          4720 ns/op           0 B/op           0 allocs/op
BenchmarkTestTruncateWordsToWholeSentenceOld-4         100000         17699 ns/op        3072 B/op           3 allocs/op
```
2016-09-14 10:50:55 +02:00
Bjørn Erik Pedersen
74ffb45fbe helpers: Improve the language prefix logic
See #2444
2016-09-13 23:44:16 +02:00
Bjørn Erik Pedersen
f53145b274 helpers: Avoid adding language prefix if already present
Fixes #2444
2016-09-13 21:37:27 +02:00
Bjørn Erik Pedersen
69a97823c4 Add Language.LanguageName
Fixes #2435
2016-09-12 20:59:03 +02:00
Bjørn Erik Pedersen
c700cdc39c Replace some leftover os.Stat with hugofs.Source 2016-09-11 20:00:38 +02:00
Bjørn Erik Pedersen
364e69ab7f Handle symlink change event
Hugo 0.16 announced support for symbolic links for the root folders, /content, /static etc., but this got broken pretty fast.

The main problem this commit tries to solve is the matching of file change events to "what changed".

An example:

ContentDir: /mysites/site/content where /mysites/site/content is a symlink to /mycontent

/mycontent:

/mypost1.md
/post/mypost2.md

* A change to mypost1.md (on OS X) will trigger a file change event with name "/mycontent/mypost1.md"
* A change to mypost2.md gives event with name "/mysites/site/content/mypost2.md"

The first change will not trigger a correct update of Hugo before this commit. This commit fixes this by doing a two-step check:

1. Check if "/mysites/site/content/mypost2.md" is within /mysites/site/content
2. Check if  "/mysites/site/content/mypost2.md" is within the real path that /mysites/site/content points to

Fixes #2265
Closes #2273
2016-09-11 20:00:38 +02:00
Bjørn Erik Pedersen
eaf2f9bce5 Add TODO list support for Blackfriday
* Add CSS class to TODO list and list items
* Add a flag to turn task list support off

Fixes #2269
2016-09-09 13:08:20 +02:00
Bjørn Erik Pedersen
76bf2dcdd2 Fix shortcode vs pygments
This is the nth attempt to fix an issue by changing the placeholder token pattern, but
now we actually have tests for all the historic trouble cases.

Fixes #2223
2016-09-08 21:23:01 +02:00
Bjørn Erik Pedersen
fe0c270577 Reset the i18n func map on reload
Also improve the error message on missing resource bundles.
2016-09-08 17:18:11 +03:00
Bjørn Erik Pedersen
a00edff5b1 Make it the DEV version 2016-09-06 23:20:59 +03:00
Bjørn Erik Pedersen
28696b5dca Small adjustment to SiteInfo init
After a visual inspection to make (pretty) sure it is correct re multiple languages.

Updates #2309
2016-09-06 18:32:20 +03:00
Bjørn Erik Pedersen
d8a256c155 Fix YAML loading of multilingual config
And some other minor fixes from code review.

Updates #2309
2016-09-06 18:32:20 +03:00
Bjørn Erik Pedersen
5b331a18d7 Add temp MULTILINGUAL version suffix to this branch
For people having trouble building this.

Now `hugo version` should print something like:

```
Hugo Static Site Generator v0.17-MULTILINGUAL BuildDate: 2016-08-10T08:20:36+02:00
```
2016-09-06 18:32:19 +03:00
Bjørn Erik Pedersen
8da040342e Render main content language in root by default
Fixes #2312
2016-09-06 18:32:18 +03:00
Bjørn Erik Pedersen
e56ecab157 Multilingual TODO-fixes, take 1
See #2309
2016-09-06 18:32:18 +03:00
Bjørn Erik Pedersen
54141f71dd Improve language handling in URLs
The current "rendering language" is needed outside of Site. This commit moves the Language type to the helpers package, and then used to get correct correct language configuration in the markdownify template func.
This commit also adds two new template funcs: relLangURL and absLangURL.

See #2309
2016-09-06 18:32:18 +03:00
Bjørn Erik Pedersen
2079a23dd8 Make it possible to configure Blackfroday per language
See #2309
2016-09-06 18:32:17 +03:00
Bjørn Erik Pedersen
ed0985404d Render the shortcodes as late as possible
This is needed to make shortcode users happy with the new multilanguage support,
but it will also solve many other related posts about "stuff not available in the shortcode".

We will have to revisit this re the handler chain at some point, but that will be easier
now as the integration test story has improved so much.

As part of this commit, the site-building tests in page_test.go is refreshed, they now
tests for all the rendering engines (when available), and all of them now uses the
same code-path as used in production.

Fixes #1229
Fixes #2323
Fixes ##1076
2016-09-06 18:32:16 +03:00
Bjørn Erik Pedersen
708bc78770 Optimize the multilanguage build process
Work In Progress!

This commit makes a rework of the build and rebuild process to better suit a multi-site setup.

This also includes a complete overhaul of the site tests. Previous these were a messy mix that
were testing just small parts of the build chain, some of it testing code-paths not even used in
"real life". Now all tests that depends on a built site follows the same and real production code path.

See #2309
Closes #2211
Closes #477
Closes #1744
2016-09-06 18:32:16 +03:00
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
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
Steve Francia
6042fc2b83 move some of the path helper utilities to afero
and provide wrappers in Hugo.
2015-12-08 16:46:43 -05:00
Bjørn Erik Pedersen
e445c35d6a Fix copyright headers in source files
Still need to add some missing headers and an AUTHORS file.

See #1646
2015-12-07 19:57:01 +01:00
Steve Francia
d356720f74 Version bump to 0.16-DEV 2015-11-25 09:49:03 -05:00
Steve Francia
6faf1d01e0 version bump to v0.15 2015-11-25 09:33:53 -05:00
Steve Francia
f045d7a611 Change the license to Apache 2.0 2015-11-23 22:16:36 -05:00
Bjørn Erik Pedersen
b00771ca14 Simplify ExtractRootPaths 2015-11-23 22:35:54 +01:00
Andrew Brampton
c3931ef748 Add PygmentsOptions option
This allows default pygments settings to be used, if none are explictly set per shortcode.

Fixes #1260
2015-11-23 17:50:54 +01:00
Marek Janda
5838420aa1 Move blackfriday site-wide config loading to NewBlackFriday() 2015-11-23 17:35:36 +01:00
Bjørn Erik Pedersen
831e936846 Improve "watching for ..." logging 2015-11-23 16:32:06 +01:00
Anthony Fok
8727475596 Fix missing word in code comment (my own fault) 2015-11-22 09:40:22 -07:00
Bjørn Erik Pedersen
8d8fa7222f Remove some superficial tests 2015-11-19 20:27:02 +01:00
Anthony Fok
e95db67b20 Add smartDashes flag for Blackfriday
To allow the end users to disable any form of smart dashes
(LaTeX-style or not) while keeping the rest of Blackfriday
SmartyPants features.

Depends on https://github.com/russross/blackfriday/pull/190
"Add HTML_SMARTYPANTS_DASHES for toggling smart dashes"
to be accepted by Blackfriday developers.
2015-10-30 13:30:25 -06:00
Bjørn Erik Pedersen
36adb5fb88 Preserve Unicode marks in MakePath
Fixes #1488
2015-10-18 10:36:27 +02:00
Nathan Youngman
ec9c691216 Insert code tag for server-side syntax highlighting
Inserts a code tag into Pygments output with the language-info that is present when using client-side highlighting (useful for CSS hooks)

```html
<code class="language-go" data-lang="go">
```

closes #1490
2015-10-15 17:59:28 +02:00
Bjørn Erik Pedersen
6a3aced15a Rename prettiyPath to prettifyPath 2015-10-15 10:15:26 +02:00
Bjørn Erik Pedersen
5619fe52d3 Unexport internal path helper 2015-10-14 21:34:34 +02:00
Bjørn Erik Pedersen
72f14a8202 Apply project wide go fmt 2015-10-12 20:47:06 +02:00
Alexander Morozov
7b4e4769d0 Fix comment for NormalizeHugoFlags 2015-10-07 21:28:29 +02:00
coderzh
823334875d WordCount and Summary support CJK Language
* add global `hasCJKLanguage` flag, if true, turn on auto-detecting CJKLanguage
 * add `isCJKLanguage` frontmatter to force specify whether is CJKLanguage or not
 * For .Summary: If isCJKLanguage is true, use the runes as basis for truncation, else keep as today.
 * For WordCount: If isCJKLanguage is true, use the runes as basis for calculation, else keep as today.
 * Unexport RuneCount

Fixes #1377
2015-10-07 15:14:57 +02:00
Andrew Brampton
c2c694f136 Add GitHub style code fence support to mmark
Fixes #1258.
2015-10-05 17:45:37 -04:00
Bjørn Erik Pedersen
218554e363 Rename NormalizeHugoFlagsFunc to NormalizeHugoFlags
It IS a func.
2015-10-02 06:48:02 +02:00
Bjørn Erik Pedersen
f5308da320 Move isThemeVsHugoVersionMismatch to /commands
To prevent potential package cycles in /helpers.
2015-09-14 17:31:39 +02:00
Anthony Fok
d05b297e61 Add helpers.NormalizeHugoFlagsFunc() to handle flag name changes
It currently handles --baseUrl to --baseURL, and --uglyUrls to --uglyURLs.

Special thanks to Eric Paris (@eparis) for writing the
"normalized name" support in Cobra, and for showing us
how it is used in Kubernetes.

See Issue #959
2015-09-13 05:20:14 -06:00
coderzh
0e1fd78fb2 WordCount Summary support UTF-8 string 2015-09-12 15:41:17 +02:00
chrongzhang
52d94fa675 Add config option "disablePathToLower"
Enabling this prevents lowercasing of the path/url.

Fixes #557
2015-09-01 15:26:02 +02:00
Bjørn Erik Pedersen
5b90b388cb Unexport FileAndExt
If needed outside helpers, create an exported file path (FilePathAndExt?)  and/or a url version.
2015-08-26 21:29:32 +02:00
Bjørn Erik Pedersen
b05a292c21 Revert "Fix some Go code doc issues"
This reverts commit de7dd70bbc.

Broke the code fence feat.
2015-08-07 20:09:40 +02:00
Bjørn Erik Pedersen
de7dd70bbc Fix some Go code doc issues 2015-08-06 22:58:10 +02:00
Anthony Fok
4a2eda49cd Add option to disable Blackfriday Smartypants
Can be used in site config or per page front matter:

```
[blackfriday]
smartypants = false
```
2015-08-04 21:42:32 +02:00
Baptiste Mathus
b23b546a30 Asciidoc[tor]: use --no-header-footer option
This simplifies the retrieval of the HTML (no more need to extract the
part within body) and also removes the unwanted "Last Updated" part in
the article.
2015-07-29 17:36:19 +02:00
Bjørn Erik Pedersen
77c60a3440 Add RuneCount to Page
Fixes #1266
2015-07-12 11:05:37 +02:00
Andrew Brampton
c139c6e1ef Add support for GitHub-flavoured markdown code fences for highlighting
This commit adds a new PygmentsCodeFences config option (default false), which if true will allow GitHub style backtick code fences around code, which will then be rendered by Pygments.

For example:

``` language
your code
```

can be used instead of {{< highlight language >}}your code {{< /highlight >}}.

Fixes #362
2015-07-08 08:12:52 +02:00
Andrew Brampton
fdab118010 If no language is provided to Pygments, then try and guess it
Previously if no language was specified, then illegal args would be passed to pygments, for example `pygments -l -fhtml`, which would result in pygments printing an error.
2015-07-08 08:12:06 +02:00
Bjørn Erik Pedersen
483fc8fa3d Add config option for Blackfriday HTML_HREF_TARGET_BLANK
Fixes #1220
2015-06-28 15:18:15 +02:00
Bjørn Erik Pedersen
05c07c561a Add option to disable Blackfriday LaTeX style dashes
Can be used in site config of per page front matter:

```
[blackfriday]
latexDashes = false
```

Fixes #1231
2015-06-28 15:08:52 +02:00
Jonathan Anderson
1058cb17d1 Refactor theme path helper functions.
Reduce duplication (`x + FilePathSeparator + y` a few lines away from `filepath.Join(x, y)`) and add a `GetThemeDir()` function to get the current theme's directory.

Also add a comment complaining about the `GetThemesDirPath()` function, which doesn't seem to do what its name would suggest. This might be a candidate for deprecation?
2015-06-25 18:05:43 +02:00
Bjørn Erik Pedersen
50269f2512 Remove superfluous return 2015-06-16 22:31:51 +02:00