]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Fix stray end p tag in Obsidian callout titles
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 5 Sep 2024 08:46:47 +0000 (10:46 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 5 Sep 2024 10:12:24 +0000 (12:12 +0200)
Also remove test references to deprecated funcs now in ERROR.

Closes #12828

hugolib/page_test.go
hugolib/securitypolicies_test.go
hugolib/site_stats_test.go
hugolib/site_test.go
markup/goldmark/blockquotes/blockquotes.go
markup/goldmark/blockquotes/blockquotes_integration_test.go
markup/goldmark/blockquotes/blockquotes_test.go

index 47f7c59c9fd2790f55e8fd72695f32958de3d66c..66afd7d966ee0768abfdfe7e7152127d50493317 100644 (file)
@@ -523,7 +523,7 @@ categories: ["cool stuff"]
        for _, p := range s.Pages() {
                checkDated(p, p.Kind())
        }
-       checkDate(s.LastChange(), "site")
+       checkDate(s.Lastmod(), "site")
 }
 
 func TestPageDatesSections(t *testing.T) {
index b0d39c6977547e3e840a56a5d3a8e5c63e6367aa..3ddda7d6a06452d7b3a50c353da9ee13dfc4028c 100644 (file)
@@ -185,35 +185,6 @@ urls="none"
 [security.http]
 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"            
 `)
                        })
        })
index 167194ef5802777a5a2e505676377360b34d5851..7fd68ff44bb814899604c5879df430f033a03b2c 100644 (file)
@@ -121,11 +121,10 @@ date: 2023-04-01
 ---
 -- layouts/index.html --
 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" }}
 
 `
        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")
 }
index 37546824a11ca41c9c65082e81103ab9216693ad..2ee33da246ad96de10e973bc08b004056d63f588 100644 (file)
@@ -147,8 +147,8 @@ func TestLastChange(t *testing.T) {
 
        s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Configs: configs}, BuildCfg{SkipRender: true})
 
-       c.Assert(s.LastChange().IsZero(), qt.Equals, false)
-       c.Assert(s.LastChange().Year(), qt.Equals, 2017)
+       c.Assert(s.Lastmod().IsZero(), qt.Equals, false)
+       c.Assert(s.Lastmod().Year(), qt.Equals, 2017)
 }
 
 // Issue #_index
index f6d1a590ee072ada8cb78f839264f277b266f476..f9d518850afe1a86c3d41e3d8c8d2e989e0de8e9 100644 (file)
@@ -164,10 +164,12 @@ var blockQuoteAlertRe = regexp.MustCompile(`^<p>\[!([a-zA-Z]+)\](-|\+)?[^\S\r\n]
 func resolveBlockQuoteAlert(s string) blockQuoteAlert {
        m := blockQuoteAlertRe.FindStringSubmatch(s)
        if len(m) == 4 {
+               title := strings.TrimSpace(m[3])
+               title = strings.TrimRight(title, "</p>")
                return blockQuoteAlert{
                        typ:   strings.ToLower(m[1]),
                        sign:  m[2],
-                       title: m[3],
+                       title: title,
                }
        }
 
index af3c1fba49a36cf987e0f013b244f9a034ce953b..1f671df2b206654a192221bc2488029e749c6833 100644 (file)
@@ -123,7 +123,6 @@ title: "Home"
 > [!danger]
 > Do not approach or handle without protective gear.
 
-
 > [!tip] Callouts can have custom titles
 > Like this one.
 
@@ -135,6 +134,10 @@ title: "Home"
 > [!faq]+ Foldable callout
 > 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 --
 {{ .Content }}
 -- layouts/_default/_markup/render-blockquote.html --
@@ -145,9 +148,11 @@ AlertType: {{ .AlertType }}|AlertTitle: {{ .AlertTitle }}|AlertSign: {{ .AlertSi
        b := hugolib.Test(t, files)
        b.AssertFileContentExact("public/index.html",
                "AlertType: tip|AlertTitle: Callouts can have custom titles|AlertSign: |",
-               "AlertType: tip|AlertTitle: Title-only callout</p>|AlertSign: |",
-               "AlertType: faq|AlertTitle: Foldable negated callout|AlertSign: -|Text: <p>Yes!",
-               "AlertType: faq|AlertTitle: Foldable callout|AlertSign: +|",
+               "AlertType: tip|AlertTitle: Title-only callout|AlertSign: |",
+               "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: +|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|",
+               "AlertTitle: Can callouts be nested?|",
+               "AlertTitle: You can even use multiple layers of nesting.|",
        )
 }
index 8b948af08c1674151431ba4f6cca67a23ded3cf3..067cf366e75997b9ef47750b520de8154c229e04 100644 (file)
@@ -63,6 +63,6 @@ func TestResolveBlockQuoteAlert(t *testing.T) {
        }
 
        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))
        }
 }