Skip to content

Commit

Permalink
Make sure we append the current buffer before appending the title
Browse files Browse the repository at this point in the history
The title ended up being added first, which was definitely not what we
wanted.

Fixes quarkusio#42036
  • Loading branch information
gsmet authored and holly-cummins committed Jul 31, 2024
1 parent c5ab66e commit 2e2cbb1
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,15 @@ private static void copyAsciidoc(Path sourceFile, Path targetFile, Set<String> d
lineNumber++;

if (!documentTitleFound && line.startsWith("= ")) {
// anything in the buffer needs to be appended
// we don't need to rewrite it as before the title we can only have the preamble
// and we don't want to change anything in the preamble
// if at some point we want to adjust the preamble, make sure to do it in a separate method and not reuse rewriteContent
if (currentBuffer.length() > 0) {
rewrittenGuide.append(currentBuffer);
currentBuffer.setLength(0);
}

// this is the document title
rewrittenGuide.append(line.replace(PROJECT_NAME_ATTRIBUTE, RED_HAT_BUILD_OF_QUARKUS) + "\n");
documentTitleFound = true;
Expand Down

0 comments on commit 2e2cbb1

Please sign in to comment.