From 6dc20b6084b3fa5a8c2741f5c139236f4ff26dbe Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 22 Jul 2024 15:55:37 +0200 Subject: [PATCH] Make sure we append the current buffer before appending the title The title ended up being added first, which was definitely not what we wanted. Fixes #42036 --- .../docs/generation/AssembleDownstreamDocumentation.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java b/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java index 2a88d1d2b106c..a12f247b1ecb7 100755 --- a/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java +++ b/docs/src/main/java/io/quarkus/docs/generation/AssembleDownstreamDocumentation.java @@ -355,6 +355,15 @@ private static void copyAsciidoc(Path sourceFile, Path targetFile, Set 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;