Commit graph

739 commits

Author SHA1 Message Date
Bjørn Erik Pedersen 4055c12184 Fix some change detection issues on server reloads
* Fix change detection when .GetPage/site.GetPage is used from shortcode
* Fix stale content for GetPage results with short name lookups on server reloads

Fixes #7623
Fixes #7624
Fixes #7625
2020-09-07 21:06:44 +02:00
Cameron Moore cdfd1c99ba tpl: Add limit support to replaceRE
Go stdlib doesn't contain a limited replace in the regexp package, but
we can accomplish the same thing with ReplaceAllStringFunc.

Fixes #7586
2020-08-28 18:57:56 +02:00
Cameron Moore 047af7cfe5 tpl: Extend merge to accept multiple parameters
Fixes #7595
2020-08-28 09:54:51 +02:00
Cameron Moore f9ebaaed1b tpl: Add limit option to replace template function
Updates #7586
2020-08-28 08:55:58 +02:00
Bjørn Erik Pedersen ae63c2b5c9
Fail on partials with return when given none or a zero argument
We need to make a proper fix for this, but it is better with an error than just silently continue.

Fixes #7572
Updates #7528
2020-08-19 10:01:16 +02:00
Kyle Anderson 5f42590144 Remove trailing whitespace and tabs from RSS templates
The rss templates had some tab characters mixed in with the spaces.
Additionally there would end up being trailing whitespace in output
rss feeds, which looks red in git diff.
2020-08-12 09:25:16 +02:00
Joe Mooring bffc4e12fe Revert "Fix ellipsis display logic in pagination template"
This reverts commit 2fa851e650.
2020-08-06 13:42:08 +02:00
Joe Mooring 2fa851e650 Fix ellipsis display logic in pagination template
Closes #7523
2020-07-31 16:08:23 +02:00
Joe Mooring a06c06a5c2 Fix date format in internal schema template
Prior to this change, the offset indicator for dates with positive
offsets was rendered as + instead of +.

Fixes #7495
2020-07-23 15:57:20 +02:00
Bjørn Erik Pedersen eded9ac2a0 resources/js: Simplify options handling
Mostly to minify cache hash breakage.

Updates #7499
2020-07-22 10:13:30 +02:00
Bjørn Erik Pedersen c91dbe4ce9 Fix baseof block regression
From Hugo 0.74.0.

Fixes #7478
2020-07-13 20:45:09 +02:00
Bjørn Erik Pedersen 25e3da3343
docs: Regenerate docs helper 2020-07-13 11:01:38 +02:00
Bjørn Erik Pedersen 9df98ec49c Add proper Media Type handling in js.Build
See #732
2020-07-13 10:56:23 +02:00
Remko Tronçon 2fc3380707 Add js.Build asset bundling
Fixes #7321
2020-07-13 10:56:23 +02:00
Bjørn Erik Pedersen 12a65e76df Add openapi3.Unmarshal
Fixes #7442
Fixes #7443
2020-07-06 20:03:36 +02:00
Bjørn Erik Pedersen 42e150fbfa Fix server reload when non-HTML shortcode changes
Fixes #7448
2020-07-03 23:31:51 +02:00
Bjørn Erik Pedersen 028b356787
tpl/strings: Add strings.Count
Fixes #7453
2020-07-03 10:35:46 +02:00
Bjørn Erik Pedersen defd7106bf
tpl: Add debug.Dump
Fixes #3957
2020-07-02 09:04:46 +02:00
Bjørn Erik Pedersen 4a3efea7ef Add support for inline partials
Fixes #7444
2020-07-01 23:10:21 +02:00
Bjørn Erik Pedersen 01e249e97c
Regenerate templates 2020-06-12 11:29:04 +02:00
Joe Mooring 4b560cc119 Beautify HTML generated by pagination template
Fixes #7199.
2020-06-12 11:27:20 +02:00
Edouard 7eeebe1e5a
tpl/crypto: Add hmac 2020-06-05 20:04:11 +02:00
Sam Smith 3d9235e8fc tpl: Fix bad rounding in NumFmt
strconv.FormatFloat doesn't round properly sometimes, this adds a
different method of rounding, fixes #7116
2020-06-02 17:20:36 +02:00
Bjørn Erik Pedersen 6c3c6686f5 Fix Go template script escaping
Fixes #6695
2020-05-23 22:00:34 +02:00
Joe Mooring 991934497e Add math.Pow
Closes #7266
2020-05-14 10:00:31 +02:00
Daniel Tipping 6205d56b85 Use .Lastmod for og:updated_time
.Lastmod is the time at which the website was most recently updated,
rather than .Date which is the time at which the website content file
was created.
2020-05-07 18:42:20 +02:00
Tom 04b1a6d997
Add support for sort by boolean 2020-05-02 11:57:34 +02:00
Bjørn Erik Pedersen 6add6d77b4 Rename transpileJS to babel
And add a test.

Updates #5764
2020-04-29 10:51:33 +02:00
Niek de Wit 2a171ff1c5 resources: Add JavaScript transpiling solution
Add a new pipe called TranspileJS which uses the Babel cli. This makes it possible for users to write ES6 JavaScript code and transpile it to ES5 during website generation so that the code still works with older browser versions.

Fixes #5764
2020-04-29 10:51:33 +02:00
BurtonQin 5146dc614f tpl/tmplimpl/template: Change defer RLock to RUnlock 2020-04-21 13:23:31 +02:00
Elliott Sales de Andrade 7791a804e2
deps: Update to latest emoji package 2020-04-08 12:56:14 +02:00
Bjørn Erik Pedersen 2f721f8ec6
Add basic "post resource publish support"
Fixes #7146
2020-04-07 21:59:20 +02:00
Cameron Moore 8568928aa8 tpl: Extend Jsonify to support options map
Add support for prefix and indent options used by json.MarshalIndent
from the Go stdlib.
2020-04-07 20:01:57 +02:00
Cameron Moore 1bc93021e3 tpl: Extend Jsonify to support optional indent parameter
Fixes #5040
2020-04-07 20:01:57 +02:00
Bjørn Erik Pedersen 7204b354a9 Some minify configuration adjustments 2020-03-20 20:35:57 +01:00
SatowTakeshi 574c2959b8 Add minify config
Fixes #6750
Updates #6892
2020-03-20 20:35:57 +01:00
Bjørn Erik Pedersen ffcb4aeb8e Fix handling of HTML files without front matter
This means that any HTML file inside /content will be treated as a regular file.

If you want it processes with shortcodes and a layout, add front matter.

The defintion of an HTML file here is:

* File with extension .htm or .html
* With first non-whitespace character "<" that isn't a HTML comment.

This is in line with the documentation.

Fixes #7030
Fixes #7028
See #6789
2020-03-09 15:01:55 +01:00
satotake 8279d2e227
Support unComparable args of uniq/complement/in
Fixes #6105
2020-03-09 13:32:38 +01:00
Sam Smith c4fa2f0799 tpl: Fix error with unicode in file paths
Add url.QueryUnescape before reading file which allows files with
unicode in their paths to be read.

Fixes #6996
2020-03-09 13:31:04 +01:00
Carl Johnson ae383f04c8 {{ in }} should work with html.Template type
Fixes #7002
2020-03-03 13:37:42 +01:00
Sam Smith d7798906d8 tpl: Change error message on missing resource
Fixes #6942
2020-03-02 18:46:14 +01:00
Bjørn Erik Pedersen b0d850321e Fix rebuild logic when editing template using a base template
We have been doing too much work in that case.

Fixes #6968
2020-02-28 14:14:55 +01:00
Chris Dennis d184e5059c
tpl: Add math.Sqrt
Fixes #6941
2020-02-24 23:45:04 +01:00
Bjørn Erik Pedersen d73e37387c
tpl: Adjust the RSS taxonomy logic
See #6909
2020-02-18 17:29:46 +01:00
Bjørn Erik Pedersen aa3e183056
tpl: Fix RSS template for the terms listing
Fixes #6909
2020-02-18 16:55:30 +01:00
Bjørn Erik Pedersen eada236f87
Introduce a tree map for all content
This commit introduces a new data structure to store pages and their resources.

This data structure is backed by radix trees.

This simplies tree operations, makes all pages a bundle,  and paves the way for #6310.

It also solves a set of annoying issues (see list below).

Not a motivation behind this, but this commit also makes Hugo in general a little bit faster and more memory effective (see benchmarks). Especially for partial rebuilds on content edits, but also when taxonomies is in use.

```
name                                   old time/op    new time/op    delta
SiteNew/Bundle_with_image/Edit-16        1.32ms ± 8%    1.00ms ± 9%  -24.42%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file/Edit-16    1.28ms ± 0%    0.94ms ± 0%  -26.26%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories/Edit-16      33.9ms ± 2%    21.8ms ± 1%  -35.67%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs/Edit-16            40.6ms ± 1%    37.7ms ± 3%   -7.20%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree/Edit-16        56.7ms ± 0%    51.7ms ± 1%   -8.82%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates/Edit-16      19.9ms ± 2%    18.3ms ± 3%   -7.64%  (p=0.029 n=4+4)
SiteNew/Page_collections/Edit-16         37.9ms ± 4%    34.0ms ± 2%  -10.28%  (p=0.029 n=4+4)
SiteNew/Bundle_with_image-16             10.7ms ± 0%    10.6ms ± 0%   -1.15%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file-16         10.8ms ± 0%    10.7ms ± 0%   -1.05%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories-16           43.2ms ± 1%    39.6ms ± 1%   -8.35%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs-16                 47.6ms ± 1%    47.3ms ± 0%     ~     (p=0.057 n=4+4)
SiteNew/Deep_content_tree-16             73.0ms ± 1%    74.2ms ± 1%     ~     (p=0.114 n=4+4)
SiteNew/Many_HTML_templates-16           37.9ms ± 0%    38.1ms ± 1%     ~     (p=0.114 n=4+4)
SiteNew/Page_collections-16              53.6ms ± 1%    54.7ms ± 1%   +2.09%  (p=0.029 n=4+4)

name                                   old alloc/op   new alloc/op   delta
SiteNew/Bundle_with_image/Edit-16         486kB ± 0%     430kB ± 0%  -11.47%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file/Edit-16     265kB ± 0%     209kB ± 0%  -21.06%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories/Edit-16      13.6MB ± 0%     8.8MB ± 0%  -34.93%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs/Edit-16            66.5MB ± 0%    63.9MB ± 0%   -3.95%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree/Edit-16        28.8MB ± 0%    25.8MB ± 0%  -10.55%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates/Edit-16      6.16MB ± 0%    5.56MB ± 0%   -9.86%  (p=0.029 n=4+4)
SiteNew/Page_collections/Edit-16         16.9MB ± 0%    16.0MB ± 0%   -5.19%  (p=0.029 n=4+4)
SiteNew/Bundle_with_image-16             2.28MB ± 0%    2.29MB ± 0%   +0.35%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file-16         2.07MB ± 0%    2.07MB ± 0%     ~     (p=0.114 n=4+4)
SiteNew/Tags_and_categories-16           14.3MB ± 0%    13.2MB ± 0%   -7.30%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs-16                 69.1MB ± 0%    69.0MB ± 0%     ~     (p=0.343 n=4+4)
SiteNew/Deep_content_tree-16             31.3MB ± 0%    31.8MB ± 0%   +1.49%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates-16           10.8MB ± 0%    10.9MB ± 0%   +1.11%  (p=0.029 n=4+4)
SiteNew/Page_collections-16              21.4MB ± 0%    21.6MB ± 0%   +1.15%  (p=0.029 n=4+4)

name                                   old allocs/op  new allocs/op  delta
SiteNew/Bundle_with_image/Edit-16         4.74k ± 0%     3.86k ± 0%  -18.57%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file/Edit-16     4.73k ± 0%     3.85k ± 0%  -18.58%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories/Edit-16        301k ± 0%      198k ± 0%  -34.14%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs/Edit-16              389k ± 0%      373k ± 0%   -4.07%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree/Edit-16          338k ± 0%      262k ± 0%  -22.63%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates/Edit-16        102k ± 0%       88k ± 0%  -13.81%  (p=0.029 n=4+4)
SiteNew/Page_collections/Edit-16           176k ± 0%      152k ± 0%  -13.32%  (p=0.029 n=4+4)
SiteNew/Bundle_with_image-16              26.8k ± 0%     26.8k ± 0%   +0.05%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file-16          26.8k ± 0%     26.8k ± 0%   +0.05%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories-16             273k ± 0%      245k ± 0%  -10.36%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs-16                   396k ± 0%      398k ± 0%   +0.39%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree-16               317k ± 0%      325k ± 0%   +2.53%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates-16             146k ± 0%      147k ± 0%   +0.98%  (p=0.029 n=4+4)
SiteNew/Page_collections-16                210k ± 0%      215k ± 0%   +2.44%  (p=0.029 n=4+4)
```

Fixes #6312
Fixes #6087
Fixes #6738
Fixes #6412
Fixes #6743
Fixes #6875
Fixes #6034
Fixes #6902
Fixes #6173
Fixes #6590
2020-02-18 09:49:42 +01:00
Bjørn Erik Pedersen f45cb31728 Fix base template handling with preceding comments
Fixes #6816
2020-01-30 23:44:42 +01:00
Bjørn Erik Pedersen f441f67512 Fix baseof with regular define regression
Fixes #6790
2020-01-23 19:54:06 +01:00
Bjørn Erik Pedersen 2fefc01606
tpl/compare: Fix eq when > 2 args
Fixes #6786
2020-01-23 10:48:28 +01:00
Tan Yuanhong 0c251be66b Allow multiple arguments in ne/ge/gt/le/lt functions
Treat op arg1 arg2 arg3 ... as (arg1 op arg2) && (arg1 op arg3)
and so on for ne/ge/gt/le/lt.

Closes #6619
2020-01-23 10:36:35 +01:00