Commit graph

287 commits

Author SHA1 Message Date
Bjørn Erik Pedersen 75d855c086 hugolib: Add check for p.Markup == "org"
To be improved.
2017-02-21 08:49:04 +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 a3af4fe46e hugolib: Finish menu vs section content pages
This commit also fixes the default menu sort when the weight is 0.

Closes #2974
2017-02-20 22:20:02 +01:00
Bjørn Erik Pedersen fe9fd0acf4 hugolib: Cache the value of Page's RelPermalink 2017-02-20 09:05:35 +01:00
bogem 7e0fa13faa Get rid of some viper.Get* calls
Enforce usage of PathSpec

Fixes #3060
Updates #2728
2017-02-20 08:10:13 +01:00
Abdó Roig-Maranges 02b120d1bd hugolib: Discard current language based on .Lang()
Otherwise we fail to skip the current language in translations
for paginated pages.

Fixes #2972
2017-02-19 15:00:18 +01:00
Anton Staaf 99fbc75e7a hugolib: Fix regression of .Truncated evaluation in manual summaries
This fixes the behavior of .Truncated that was introduced with commit
bef496b97e which was later broken.  The
desired behavior is that .Truncated would evaluate to false when there
was nothing after the user defined summary marker.

This also adds a simple unit test to ensure that this feature isn't
broken again.  The check for content after the user defined summary
marker is done on the raw content instead of the working copy because
some of the markup renderers add elements after the marker, making it
difficult to determine if there is actually any content.

The behavior (evaluating to false when there is no content, just
summary) is also now documented.
2017-02-19 10:11:49 +01:00
Bjørn Erik Pedersen 9416fdd334 hugolib: Add missing page kind to allKinds 2017-02-19 09:15:30 +01:00
John Feminella b2e3748a4e hugolib: Enhance .Param to permit arbitrarily nested parameter references
The Param method currently assumes that its argument is a single,
distinct, top-level key to look up in the Params map. This enhances the
Param method; it will now also attempt to see if the key can be
interpreted as a nested chain of keys to look up in Params.

Fixes #2598
2017-02-19 08:50:08 +01:00
Bjørn Erik Pedersen 6d2281c8ea hugolib: Add disableKinds option
Fixes #2534
2017-02-18 22:53:23 +01:00
Bjørn Erik Pedersen 04a4a193a9 hugolib: Remove deprecated marked for removal
Fixes #3029
2017-02-17 17:20:46 +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
Bjørn Erik Pedersen 25bfa7e12f hugolib: Use the site's Tmpl for non-renderable pages 2017-02-10 10:44:35 +07: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 d6000a208c all: Refactor to nonglobal template handling
Updates #2701
2017-01-10 01:36:59 +01:00
Bjørn Erik Pedersen 45e3ed517a all: Refactor to non-global logger
Note that this looks like overkill for just the logger, and that is correct,
but this will make sense once we start with the template handling etc.

Updates #2701
2017-01-07 17:06:35 +01:00
Cameron Moore 3d058a936f hugolib: Allow arrays of arrays in frontmatter Params
Fixes #2752
2017-01-06 11:56:22 +01:00
Bjørn Erik Pedersen 6e0f326b9d hugolib: Deprecate Page.Now
Use `now` (template func).

See cabc6b3186
2017-01-01 13:10:36 +01:00
Bjørn Erik Pedersen 695be00c07 hugolib: Bump the current warning deprecations
Fixes #2836
2017-01-01 12:36:21 +01:00
Bjørn Erik Pedersen bcb3ef7413 hugolib: Fix preserveTaxonomyNames regressions
Fixes #2809
2016-12-28 13:44:55 +01:00
Bjørn Erik Pedersen 88b5bbd532 hugolib: Fix IsTranslated for "old" node types
The new logic for creating Page objects from old node types
didn't include itself in the translation logic, so
`IsTranslated` returned falsely false for sites with only two languages.

The `AllTranslations` method also returned too few pages in that case.

This commit fixes that.

Fixes #2812
2016-12-27 12:01:54 +01:00
Cameron Moore 17f851780c hugolib: Fix redundant URL file extension on taxonomy terms pages
Fixes #2819
2016-12-27 11:18:47 +01:00
Bjørn Erik Pedersen 2f026ab3f3 hugolib: Make RawContent raw again
This was a regression introduced in Hugo 0.17.

Fixes #2601
2016-12-01 17:29:49 +01:00
Bjørn Erik Pedersen 20d82a7a1b hugolib: Create the permalink once only 2016-11-27 19:25:28 +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 1f6e0de361 hugolib: Avoid repeated Viper loads of sectionPagesMenu
See #2728
2016-11-24 10:54:15 +01:00
Bjørn Erik Pedersen 4360452001 hugolib: Simplify 2016-11-23 18:32:17 +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 dec1706ae0 commands, hugolib, parser, tpl: Use errors.New instead of fmt.Errorf 2016-11-22 23:43:55 +01:00
Bjørn Erik Pedersen e1da7cb320 Fix case issues with Params
There are currently several Params and case related issues floating around in Hugo.

This is very confusing for users and one of the most common support questions on the forum.

And while there have been done some great leg work in Viper etc., this is of limited value since this and similar doesn't work:

`Params.myCamelCasedParam`

Hugo has control over all the template method invocations, and can take care of all the lower-casing of the map lookup keys.

But that doesn't help with direct template lookups of type `Site.Params.TWITTER_CONFIG.USER_ID`.

This commit solves that by doing some carefully crafted modifications of the templates' AST -- lowercasing the params keys.

This is low-level work, but it's not like the template API wil change -- and this is important enough to defend such "bit fiddling".

Tests are added for all the template engines: Go templates, Ace and Amber.

Fixes #2615
Fixes #1129
Fixes #2590
2016-11-22 17:33:52 +01:00
Bjørn Erik Pedersen 976f8f84bf node to page: Fixe index page translation issues
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 32fb1e6fac node to page: Need to append theme templates
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 28031b0897 node to page: Only return regular pages in home.Data.Pages
Returning all types is both confusing and too breaking.

All page types can be fetched in .Site.Pages.

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen a843d5d3bb node to page: Final TODO-fixes
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 99d11386a7 node to page: Fix the Page copy()
By embeding the init sync.Once var in a pointer so we can reset it when we copy the page.

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 62e9e7e6ba node to page: Misc. TODO-fixes
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 524eb16686 node to page: Handle URLs
This includes removing the error return value from Permalink and RelPermalink.

We ignore that error all over the place, so we might as well remove it.

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen c8d3124dde node to page: Remove Node
And misc. TODO-fixes

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 9347084d61 node to page: Make Kind a string
Having a custom string type isn't worth it when it doesn't work
with `where`, `eq` etc.

Fixes #2689
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 9fba2a30a9 node to page: Rename PageType to Kind
And embed that on Page.

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 487b210fb8 node to page: Handle Date and Lastmod
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen c80308e6b3 node to page: Add Pages to Page
As an alias to .Data.Pages for home page etc.

Also renamte NodeType to PageType and make it a string so it can be used in `where`.

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 063b78d2ec node to page: Make Nodes into Pages
* `.Site.Pages` now contains all page types, including sections etc.
* `.Data.Pages` will also contain "node type" pages where relevant.

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 80e453f114 node to page: Fix home target path on Windows
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen bde1bfd34a node to page: Handle aliases, 404, robots.txt, sitemap
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen ec2d502b4f node to page: Handle translations
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 698b994f71 node to page: Fix the page collections
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 3ff25b37a3 node to page: Handle RSS
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 75c38071d8 node to page: Create pages for nodes without content
Updates #2297
2016-11-22 09:57:03 +01:00