Skip to content

Commit

Permalink
Merge pull request quarkusio#38429 from gsmet/replace-project-name-in…
Browse files Browse the repository at this point in the history
…-document-title

Replace {project-name} attribute in document title for downstream
  • Loading branch information
gsmet authored Jan 30, 2024
2 parents ffec931 + 22e6403 commit 8d799c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/datasource.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ and pull requests should be submitted there:
https://github.com/quarkusio/quarkus/tree/main/docs/src/main/asciidoc
////
[id="datasources"]
= Configure data sources in Quarkus
= Configure data sources in {project-name}
include::_attributes.adoc[]
:diataxis-type: reference
:categories: data,getting-started,reactive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public class AssembleDownstreamDocumentation {
private static final String SOURCE_BLOCK_PREFIX = "[source";
private static final String SOURCE_BLOCK_DELIMITER = "--";

private static final String PROJECT_NAME_ATTRIBUTE = "{project-name}";
private static final String RED_HAT_BUILD_OF_QUARKUS = "Red Hat build of Quarkus";

private static final String QUARKUS_IO_GUIDES_ATTRIBUTE = "{quarkusio-guides}";

private static final Map<Pattern, String> TABS_REPLACEMENTS = Map.of(
Expand Down Expand Up @@ -301,10 +304,17 @@ private static void copyAsciidoc(Path sourceFile, Path targetFile, Set<String> d
boolean findDelimiter = false;
String currentSourceBlockDelimiter = "----";
int lineNumber = 0;
boolean documentTitleFound = false;

for (String line : guideLines) {
lineNumber++;

if (!documentTitleFound && line.startsWith("= ")) {
// this is the document title
rewrittenGuide.append(line.replace(PROJECT_NAME_ATTRIBUTE, RED_HAT_BUILD_OF_QUARKUS) + "\n");
documentTitleFound = true;
continue;
}
if (inSourceBlock) {
if (findDelimiter) {
rewrittenGuide.append(line + "\n");
Expand Down

0 comments on commit 8d799c4

Please sign in to comment.