Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
markup/asciidocext: Correct attribute derivation for workingFolderCur…
…rent

Fixes issues with `outdir`, `imagesoutdir`, and `imagesdir` when
`markup.asciidocext.workingFolderCurrent` is active. The prior logic
failed in several scenarios due to improper attribute derivation from the
page's relative permalink.

The updated logic now correctly handles:

- Multi-byte characters
- Multilingual multi-host sites
- Site builds from a subdirectory
- Pages using ugly URLs

Closes #9202
Closes #10183
Closes #10473
  • Loading branch information
jmooring committed Nov 1, 2025
commit 0a3a875c3bcaa04a85349a50e841f25d33a8f8bf
2 changes: 1 addition & 1 deletion htesting/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func IsGitHubAction() bool {
}

// SupportsAll reports whether the running system supports all Hugo features,
// e.g. Asciidoc, Pandoc etc.
// e.g. AsciiDoc, Pandoc etc.
func SupportsAll() bool {
return IsGitHubAction() || os.Getenv("CI_LOCAL") != ""
}
Expand Down
6 changes: 3 additions & 3 deletions hugolib/page_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ func testAllMarkdownEnginesForPages(t *testing.T,
shouldExecute func() bool
}{
{"md", func() bool { return true }},
{"ad", func() bool { return asciidocext.Supports() }},
{"ad", func() bool { ok, _ := asciidocext.Supports(); return ok }},
{"rst", func() bool { return !htesting.IsRealCI() && rst.Supports() }},
}

Expand Down Expand Up @@ -591,7 +591,7 @@ func TestPageSummary(t *testing.T) {
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
p := pages[0]
checkPageTitle(t, p, "SimpleWithoutSummaryDelimiter")
// Source is not Asciidoctor- or RST-compatible so don't test them
// Source is not AsciiDoc- or RST-compatible so don't test them
if ext != "ad" && ext != "rst" {
checkPageContent(t, p, normalizeExpected(ext, "<p><a href=\"https://lipsum.com/\">Lorem ipsum</a> dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>\n\n<p>Additional text.</p>\n\n<p>Further text.</p>\n"), ext)
checkPageSummary(t, p, normalizeExpected(ext, "<p><a href=\"https://lipsum.com/\">Lorem ipsum</a> dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p><p>Additional text.</p>"), ext)
Expand Down Expand Up @@ -621,7 +621,7 @@ func TestPageWithSummaryParameter(t *testing.T) {
p := pages[0]
checkPageTitle(t, p, "SimpleWithSummaryParameter")
checkPageContent(t, p, normalizeExpected(ext, "<p>Some text.</p>\n\n<p>Some more text.</p>\n"), ext)
// Summary is not Asciidoctor- or RST-compatible so don't test them
// Summary is not AsciiDoc- or RST-compatible so don't test them
if ext != "ad" && ext != "rst" {
checkPageSummary(t, p, normalizeExpected(ext, "Page with summary parameter and <a href=\"http://www.example.com/\">a link</a>"), ext)
}
Expand Down
14 changes: 7 additions & 7 deletions hugolib/pagesfromdata/pagesfromgotmpl_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ docs/p1/sub/mymixcasetext2.txt
b.AssertFileContent("public/docs/p3/index.html", "<strong>Hello World Default</strong>")
}

func TestPagesFromGoTmplAsciidocAndSimilar(t *testing.T) {
func TestPagesFromGoTmplAsciiDocAndSimilar(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ["taxonomy", "term", "rss", "sitemap"]
Expand All @@ -153,7 +153,7 @@ allow = ['asciidoctor', 'pandoc','rst2html', 'python']

b := hugolib.Test(t, files)

if asciidocext.Supports() {
if ok, _ := asciidocext.Supports(); ok {
b.AssertFileContent("public/docs/asciidoc/index.html",
"Mark my words, <mark>automation is essential</mark>",
"Path: /docs/asciidoc|",
Expand Down Expand Up @@ -511,7 +511,7 @@ baseURL = "https://example.com"
func TestPagesFromGoTmplCascade(t *testing.T) {
t.Parallel()

files := `
files := `
-- hugo.toml --
disableKinds = ["taxonomy", "term", "rss", "sitemap"]
baseURL = "https://example.com"
Expand All @@ -531,7 +531,7 @@ baseURL = "https://example.com"
func TestPagesFromGoBuildOptions(t *testing.T) {
t.Parallel()

files := `
files := `
-- hugo.toml --
disableKinds = ["taxonomy", "term", "rss", "sitemap"]
baseURL = "https://example.com"
Expand Down Expand Up @@ -719,11 +719,11 @@ func TestPagesFromGoTmplMenusMap(t *testing.T) {
-- hugo.toml --
disableKinds = ['rss','section','sitemap','taxonomy','term']
-- content/_content.gotmpl --
{{ $menu1 := dict
{{ $menu1 := dict
"parent" "main-page"
"identifier" "id1"
}}
{{ $menu2 := dict
{{ $menu2 := dict
"parent" "main-page"
"identifier" "id2"
}}
Expand Down Expand Up @@ -934,7 +934,7 @@ Title: {{ .Title }}|Content: {{ .Content }}|
func TestPagesFromGoTmplHome(t *testing.T) {
t.Parallel()

files := `
files := `
-- hugo.toml --
disableKinds = ["taxonomy", "term", "rss", "sitemap"]
baseURL = "https://example.com"
Expand Down
6 changes: 3 additions & 3 deletions hugolib/rebuild_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1838,9 +1838,9 @@ Myotherpartial Inline.|{{ .Title }}|
b.AssertFileContent("public/index.html", "My inline partial in all Edited.")
}

func TestRebuildEditAsciidocContentFile(t *testing.T) {
if !asciidocext.Supports() {
t.Skip("skip asciidoc")
func TestRebuildEditAsciiDocContentFile(t *testing.T) {
if ok, err := asciidocext.Supports(); !ok {
t.Skip(err)
}
files := `
-- hugo.toml --
Expand Down
6 changes: 3 additions & 3 deletions hugolib/securitypolicies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ func TestSecurityPolicies(t *testing.T) {
testVariant(c, cb, "")
})

c.Run("Asciidoc, denied", func(c *qt.C) {
c.Run("AsciiDoc, denied", func(c *qt.C) {
c.Parallel()
if !asciidocext.Supports() {
c.Skip()
if ok, err := asciidocext.Supports(); !ok {
c.Skip(err)
}

cb := func(b *sitesBuilder) {
Expand Down
Loading
Loading