From 95019e7056dc33d56bab6bd92a01fbe6aeadc8e9 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Tue, 7 Nov 2023 06:22:36 +0100 Subject: [PATCH] Load shared attributes.adoc if present and use when parsing attributes for a guide (#429) --- src/main/java/org/keycloak/webbuilder/Guides.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/keycloak/webbuilder/Guides.java b/src/main/java/org/keycloak/webbuilder/Guides.java index b591f323..340bd34f 100644 --- a/src/main/java/org/keycloak/webbuilder/Guides.java +++ b/src/main/java/org/keycloak/webbuilder/Guides.java @@ -68,8 +68,11 @@ private void loadGuides(AsciiDoctor asciiDoctor, File d, GuideCategory category) Map guidePriorities = loadPinnedGuides(new File(d, "pinned-guides")); + File sharedAttributesFile = new File(d.getParentFile(), "attributes.adoc"); + Map sharedAttributes = sharedAttributesFile.isFile() ? asciiDoctor.parseAttributes(sharedAttributesFile) : Collections.emptyMap(); + for (File f: d.listFiles((dir, name) -> name.endsWith(".adoc") && !name.equals("index.adoc"))) { - Map attributes = asciiDoctor.parseAttributes(f); + Map attributes = asciiDoctor.parseAttributes(f, sharedAttributes); boolean community = "true".equals(attributes.get("community")); try {