mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Fix stray end p tag in Obsidian callout titles
Also remove test references to deprecated funcs now in ERROR. Closes #12828
This commit is contained in:
parent
8f2eac0195
commit
66a3a11001
7 changed files with 17 additions and 40 deletions
|
@ -523,7 +523,7 @@ categories: ["cool stuff"]
|
||||||
for _, p := range s.Pages() {
|
for _, p := range s.Pages() {
|
||||||
checkDated(p, p.Kind())
|
checkDated(p, p.Kind())
|
||||||
}
|
}
|
||||||
checkDate(s.LastChange(), "site")
|
checkDate(s.Lastmod(), "site")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPageDatesSections(t *testing.T) {
|
func TestPageDatesSections(t *testing.T) {
|
||||||
|
|
|
@ -185,35 +185,6 @@ urls="none"
|
||||||
[security.http]
|
[security.http]
|
||||||
mediaTypes=["application/json"]
|
mediaTypes=["application/json"]
|
||||||
|
|
||||||
`)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
c.Run("getJSON, OK", func(c *qt.C) {
|
|
||||||
c.Parallel()
|
|
||||||
httpTestVariant(c, `{{ $json := getJSON "%[1]s/fruits.json" }}{{ $json.Content }}`, "", nil)
|
|
||||||
})
|
|
||||||
|
|
||||||
c.Run("getJSON, denied URL", func(c *qt.C) {
|
|
||||||
c.Parallel()
|
|
||||||
httpTestVariant(c, `{{ $json := getJSON "%[1]s/fruits.json" }}{{ $json.Content }}`, `(?s).*is not whitelisted in policy "security\.http\.urls".*`,
|
|
||||||
func(b *sitesBuilder) {
|
|
||||||
b.WithConfigFile("toml", `
|
|
||||||
[security]
|
|
||||||
[security.http]
|
|
||||||
urls="none"
|
|
||||||
`)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
c.Run("getCSV, denied URL", func(c *qt.C) {
|
|
||||||
c.Parallel()
|
|
||||||
httpTestVariant(c, `{{ $d := getCSV ";" "%[1]s/cities.csv" }}{{ $d.Content }}`, `(?s).*is not whitelisted in policy "security\.http\.urls".*`,
|
|
||||||
func(b *sitesBuilder) {
|
|
||||||
b.WithConfigFile("toml", `
|
|
||||||
[security]
|
|
||||||
[security.http]
|
|
||||||
urls="none"
|
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -121,11 +121,10 @@ date: 2023-04-01
|
||||||
---
|
---
|
||||||
-- layouts/index.html --
|
-- layouts/index.html --
|
||||||
site.Lastmod: {{ .Site.Lastmod.Format "2006-01-02" }}
|
site.Lastmod: {{ .Site.Lastmod.Format "2006-01-02" }}
|
||||||
site.LastChange: {{ .Site.LastChange.Format "2006-01-02" }}
|
|
||||||
home.Lastmod: {{ site.Home.Lastmod.Format "2006-01-02" }}
|
home.Lastmod: {{ site.Home.Lastmod.Format "2006-01-02" }}
|
||||||
|
|
||||||
`
|
`
|
||||||
b := Test(t, files)
|
b := Test(t, files)
|
||||||
|
|
||||||
b.AssertFileContent("public/index.html", "site.Lastmod: 2023-04-01\nsite.LastChange: 2023-04-01\nhome.Lastmod: 2023-01-01")
|
b.AssertFileContent("public/index.html", "site.Lastmod: 2023-04-01\nhome.Lastmod: 2023-01-01")
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,8 +147,8 @@ func TestLastChange(t *testing.T) {
|
||||||
|
|
||||||
s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Configs: configs}, BuildCfg{SkipRender: true})
|
s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Configs: configs}, BuildCfg{SkipRender: true})
|
||||||
|
|
||||||
c.Assert(s.LastChange().IsZero(), qt.Equals, false)
|
c.Assert(s.Lastmod().IsZero(), qt.Equals, false)
|
||||||
c.Assert(s.LastChange().Year(), qt.Equals, 2017)
|
c.Assert(s.Lastmod().Year(), qt.Equals, 2017)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue #_index
|
// Issue #_index
|
||||||
|
|
|
@ -164,10 +164,12 @@ var blockQuoteAlertRe = regexp.MustCompile(`^<p>\[!([a-zA-Z]+)\](-|\+)?[^\S\r\n]
|
||||||
func resolveBlockQuoteAlert(s string) blockQuoteAlert {
|
func resolveBlockQuoteAlert(s string) blockQuoteAlert {
|
||||||
m := blockQuoteAlertRe.FindStringSubmatch(s)
|
m := blockQuoteAlertRe.FindStringSubmatch(s)
|
||||||
if len(m) == 4 {
|
if len(m) == 4 {
|
||||||
|
title := strings.TrimSpace(m[3])
|
||||||
|
title = strings.TrimRight(title, "</p>")
|
||||||
return blockQuoteAlert{
|
return blockQuoteAlert{
|
||||||
typ: strings.ToLower(m[1]),
|
typ: strings.ToLower(m[1]),
|
||||||
sign: m[2],
|
sign: m[2],
|
||||||
title: m[3],
|
title: title,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,6 @@ title: "Home"
|
||||||
> [!danger]
|
> [!danger]
|
||||||
> Do not approach or handle without protective gear.
|
> Do not approach or handle without protective gear.
|
||||||
|
|
||||||
|
|
||||||
> [!tip] Callouts can have custom titles
|
> [!tip] Callouts can have custom titles
|
||||||
> Like this one.
|
> Like this one.
|
||||||
|
|
||||||
|
@ -135,6 +134,10 @@ title: "Home"
|
||||||
> [!faq]+ Foldable callout
|
> [!faq]+ Foldable callout
|
||||||
> Yes! In a foldable callout, the contents are hidden when the callout is collapsed
|
> Yes! In a foldable callout, the contents are hidden when the callout is collapsed
|
||||||
|
|
||||||
|
> [!info] Can callouts be nested?
|
||||||
|
> > [!important] Yes!, they can.
|
||||||
|
> > > [!tip] You can even use multiple layers of nesting.
|
||||||
|
|
||||||
-- layouts/index.html --
|
-- layouts/index.html --
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
-- layouts/_default/_markup/render-blockquote.html --
|
-- layouts/_default/_markup/render-blockquote.html --
|
||||||
|
@ -145,9 +148,11 @@ AlertType: {{ .AlertType }}|AlertTitle: {{ .AlertTitle }}|AlertSign: {{ .AlertSi
|
||||||
b := hugolib.Test(t, files)
|
b := hugolib.Test(t, files)
|
||||||
b.AssertFileContentExact("public/index.html",
|
b.AssertFileContentExact("public/index.html",
|
||||||
"AlertType: tip|AlertTitle: Callouts can have custom titles|AlertSign: |",
|
"AlertType: tip|AlertTitle: Callouts can have custom titles|AlertSign: |",
|
||||||
"AlertType: tip|AlertTitle: Title-only callout</p>|AlertSign: |",
|
"AlertType: tip|AlertTitle: Title-only callout|AlertSign: |",
|
||||||
"AlertType: faq|AlertTitle: Foldable negated callout|AlertSign: -|Text: <p>Yes!",
|
"AlertType: faq|AlertTitle: Foldable negated callout|AlertSign: -|Text: <p>Yes! In a foldable callout, the contents are hidden when the callout is collapsed</p>\n|",
|
||||||
"AlertType: faq|AlertTitle: Foldable callout|AlertSign: +|",
|
"AlertType: faq|AlertTitle: Foldable callout|AlertSign: +|Text: <p>Yes! In a foldable callout, the contents are hidden when the callout is collapsed</p>\n|",
|
||||||
"AlertType: danger|AlertTitle: |AlertSign: |Text: <p>Do not approach or handle without protective gear.</p>\n|",
|
"AlertType: danger|AlertTitle: |AlertSign: |Text: <p>Do not approach or handle without protective gear.</p>\n|",
|
||||||
|
"AlertTitle: Can callouts be nested?|",
|
||||||
|
"AlertTitle: You can even use multiple layers of nesting.|",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,6 @@ func TestResolveBlockQuoteAlert(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
c.Assert(resolveBlockQuoteAlert("<p>"+test.input), qt.Equals, test.expected, qt.Commentf("Test %d", i))
|
c.Assert(resolveBlockQuoteAlert("<p>"+test.input+"</p>"), qt.Equals, test.expected, qt.Commentf("Test %d", i))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue