Skip to content

Let APT macro blocks end at the last brace on the line - #1069

Merged
slachiewicz merged 1 commit into
apache:masterfrom
slachiewicz:fix-apt-macro-closing-brace
Sep 3, 2026
Merged

slachiewicz merged 1 commit into
apache:masterfrom
slachiewicz:fix-apt-macro-closing-brace

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

MacroBlock.traverse() located the end of the macro with indexOf('}'),
which is the first closing brace. A parameter value containing braces
therefore truncated the macro, silently dropping the rest of the value.

This shows up when the raw source of a *.apt.vm file is parsed, where
Velocity references are still unresolved:

%{snippet|file=${project.build.directory}/test-classes/resolve.txt}

parsed as file=${project.build.directory}, dropping the path. In a normal
site build Velocity runs first so no brace remains, but doxia-converter
parses the unprocessed source and lost the parameter.

The macro block always ends with the closing brace, so use lastIndexOf.

Part of the wider migration tracked in
apache/maven-doxia-converter#139

MacroBlock.traverse() located the end of the macro with indexOf('}'),
which is the *first* closing brace. A parameter value containing braces
therefore truncated the macro, silently dropping the rest of the value.

This shows up when the raw source of a *.apt.vm file is parsed, where
Velocity references are still unresolved:

  %{snippet|file=${project.build.directory}/test-classes/resolve.txt}

parsed as file=${project.build.directory}, dropping the path. In a normal
site build Velocity runs first so no brace remains, but doxia-converter
parses the unprocessed source and lost the parameter.

The macro block always ends with the closing brace, so use lastIndexOf.
@slachiewicz slachiewicz added enhancement New feature or request and removed maintenance labels Aug 6, 2026
@slachiewicz
slachiewicz merged commit c480c9c into apache:master Sep 3, 2026
11 checks passed
@github-actions github-actions Bot added this to the 2.2.0 milestone Sep 3, 2026
@slachiewicz
slachiewicz deleted the fix-apt-macro-closing-brace branch September 7, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant