Bjørn Erik Pedersen
1e91e46520
parser/pageparser: Fix shortcode nesting regression
...
This reverts commit a133393eda .
While that commit fixed a bug, it introduced a worse one.
Closes #14054
2025-10-16 18:50:02 +02:00
Bjørn Erik Pedersen
4414ef73f3
parser/pageparser: Store shortcode names as unique.Handle[string] to save memory allocations
...
```
│ stash.bench │ perf-pagelexer.bench │
│ sec/op │ sec/op vs base │
ShortcodeLexer-10 68.87µ ± ∞ ¹ 65.91µ ± ∞ ¹ ~ (p=0.200 n=4)
Parse-10 7.421µ ± ∞ ¹ 7.030µ ± ∞ ¹ -5.28% (p=0.029 n=4)
HasShortcode/Match-10 70.42n ± ∞ ¹ 77.37n ± ∞ ¹ +9.86% (p=0.029 n=4)
HasShortcode/NoMatch-10 14.32n ± ∞ ¹ 14.38n ± ∞ ¹ ~ (p=0.086 n=4)
geomean 847.2n 847.3n +0.01%
¹ need >= 6 samples for confidence interval at level 0.95
│ stash.bench │ perf-pagelexer.bench │
│ B/op │ B/op vs base │
ShortcodeLexer-10 181.3Ki ± ∞ ¹ 177.4Ki ± ∞ ¹ -2.19% (p=0.029 n=4)
Parse-10 24.56Ki ± ∞ ¹ 24.19Ki ± ∞ ¹ -1.53% (p=0.029 n=4)
HasShortcode/Match-10 0.000 ± ∞ ¹ 0.000 ± ∞ ¹ ~ (p=1.000 n=4) ²
HasShortcode/NoMatch-10 0.000 ± ∞ ¹ 0.000 ± ∞ ¹ ~ (p=1.000 n=4) ²
geomean ³ -0.93% ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean
│ stash.bench │ perf-pagelexer.bench │
│ allocs/op │ allocs/op vs base │
ShortcodeLexer-10 1004.0 ± ∞ ¹ 921.0 ± ∞ ¹ -8.27% (p=0.029 n=4)
Parse-10 34.00 ± ∞ ¹ 14.00 ± ∞ ¹ -58.82% (p=0.029 n=4)
HasShortcode/Match-10 0.000 ± ∞ ¹ 0.000 ± ∞ ¹ ~ (p=1.000 n=4) ²
HasShortcode/NoMatch-10 0.000 ± ∞ ¹ 0.000 ± ∞ ¹ ~ (p=1.000 n=4) ²
```
2025-10-05 19:06:46 +02:00
Bjørn Erik Pedersen
a133393eda
parser/pagerparser: Fix closing shortcode error handling when repeated
2025-10-05 19:06:46 +02:00
Guilherme Soares
c939c33fd3
parser/pageparser: Don't allow parameters after closing tag in shortcodes
...
Problem:
Previously, the following self-closing shortcode syntax was incorrectly allowed:
{{% sc / param %}}
Solution:
Only allow parameters before the self-closing tag
2025-01-24 15:31:44 +01:00
Bjørn Erik Pedersen
a795acbcd8
all: Run gofumpt -l -w .
2024-01-28 23:14:09 +01:00
Phil Davis
04b89857e1
all: Fix minor typos
2020-12-16 12:11:32 +01:00
Bjørn Erik Pedersen
d90e37e0c6
all: Format code with gofumpt
...
See https://github.com/mvdan/gofumpt
2020-12-03 13:12:58 +01:00
Philipp Klose
8d72512825
make sure documentation intro text only appears once
2020-07-21 00:47:55 +02:00
Joshua Wong
21ca2e9ce4
Add support for newline characters in raw string shortcode
2020-01-18 11:24:10 +01:00
Joshua Wong
da81455656
Allow raw string literals in shortcode params
2020-01-15 09:27:19 +01:00
Bjørn Erik Pedersen
329e88db1f
Support typed bool, int and float in shortcode params
...
This means that you now can do:
{{< vidur 9KvBeKu false true 32 3.14 >}}
And the boolean and numeric values will be converted to `bool`, `int` and `float64`.
If you want these to be strings, they must be quoted:
{{< vidur 9KvBeKu "false" "true" "32" "3.14" >}}
Fixes #6371
2019-09-29 23:22:41 +02:00
Bjørn Erik Pedersen
c52045bbb3
Fix some inline shortcode issues
...
Fixes #5645
Fixes #5653
2019-01-31 19:08:19 +01:00
Bjørn Erik Pedersen
a8853f1c5a
parser/pageparser: Split the page lexer into some more files
...
See #5534
2018-12-20 20:08:01 +01:00