From 32109a2bacb6cb2f01f39f145681a5235d35e126 Mon Sep 17 00:00:00 2001 From: Alexander Schramm Date: Fri, 9 Jun 2023 18:21:03 +0200 Subject: [PATCH 1/8] Replace Gradle plugin for AsciiDoctor with own integration, as plugin is stuck on an old library version --- build.gradle | 106 +++------------ src/main/java/org/isaqb/asciidoc/Main.java | 143 +++++++++++++++++++++ 2 files changed, 164 insertions(+), 85 deletions(-) create mode 100644 src/main/java/org/isaqb/asciidoc/Main.java diff --git a/build.gradle b/build.gradle index 098182e..9f283f7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,104 +1,40 @@ -import org.asciidoctor.gradle.jvm.AsciidoctorTask import java.text.SimpleDateFormat +import java.util.* plugins { - id "org.asciidoctor.jvm.base" version "3.3.2" - id "org.asciidoctor.jvm.convert" version "3.3.2" - id "org.asciidoctor.jvm.pdf" version "3.3.2" + id "java" + id "application" } + +def group = "org.isaqb" +def version = "1.0-SNAPSHOT" + repositories { mavenCentral() } -asciidoctorj { - version = '2.5.3' +dependencies { + implementation("org.asciidoctor:asciidoctorj:2.5.8") + implementation("org.asciidoctor:asciidoctorj-pdf:2.3.7") } -ext { - today = new Date() - versionDate = new SimpleDateFormat("yyyyMMdd").format(today) - - releaseVersion = System.getenv("RELEASE_VERSION") - localVersion = "LocalBuild" - project.version = releaseVersion == null ? localVersion : releaseVersion; +def curriculumFileName = "curriculum-template" +def versionDate = new SimpleDateFormat("yyyyMMdd").format(new Date()) +def languages = ["DE", "EN"] - curriculumFileName = "curriculum-template" - addSuffixToCurriculum = { suffix -> - for (extension in ["html", "pdf"]) { - File source = new File("${buildDir}/${curriculumFileName}.${extension}") - File target = new File("${buildDir}/${curriculumFileName}${suffix}.${extension}") - - source.renameTo(target) - } - } +application { + mainClass.set("org.isaqb.asciidoc.Main") + applicationDefaultJvmArgs = [ + """-DcurriculumFileName=${curriculumFileName}""", + """-DversionDate=${versionDate}""", + """-Dlanguages=${languages.join(',')}"""] } - - - -class RenderCurriculumTask extends AsciidoctorTask { - @Inject - RenderCurriculumTask(WorkerExecutor we, String curriculumFileName, String versionDate, String language) { - super(we) - - forkOptions { - jvmArgs "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED" - } - - - sourceDir = new File("./docs/") - baseDir = new File ("./docs/") - sources { - include "index.adoc" - include "${curriculumFileName}.adoc" - } - outputDir = new File("./build/") - outputOptions { - separateOutputDirs = false - backends 'pdf', 'html5' - } - - def fileVersion = project.version.trim() + "-" + language - - attributes = [ - 'icons' : 'font', - 'version-label' : '', - 'revnumber' : fileVersion, - 'revdate' : versionDate, - 'document-version' : fileVersion + "-" + versionDate, - 'currentDate' : versionDate, - 'language' : language, - 'curriculumFileName': curriculumFileName, - 'debug_adoc' : false, - 'pdf-stylesdir' : '../pdf-theme/themes', - 'pdf-fontsdir' : '../pdf-theme/fonts', - 'pdf-style' : 'isaqb', - 'stylesheet' : '../html-theme/adoc-github.css', - 'stylesheet-dir' : '../html-theme' - ] - } -} +apply from: 'scripts/includeLearningObjectives.gradle' task buildDocs { - group 'Documentation' description 'Grouping task for generating all languages in several formats' - dependsOn "includeLearningObjectives", "renderDE", "renderEN" -} - -task renderDE(type: RenderCurriculumTask, - constructorArgs: [curriculumFileName, versionDate, "DE"]) { - doLast { - addSuffixToCurriculum("-de") - } -} - -task renderEN(type: RenderCurriculumTask, - constructorArgs: [curriculumFileName, versionDate, "EN"]) { - doLast { - addSuffixToCurriculum("-en") - } + dependsOn "includeLearningObjectives", "run" } -apply from: 'scripts/includeLearningObjectives.gradle' - defaultTasks "buildDocs" diff --git a/src/main/java/org/isaqb/asciidoc/Main.java b/src/main/java/org/isaqb/asciidoc/Main.java new file mode 100644 index 0000000..d776e9c --- /dev/null +++ b/src/main/java/org/isaqb/asciidoc/Main.java @@ -0,0 +1,143 @@ +package org.isaqb.asciidoc; + +import org.asciidoctor.Asciidoctor; +import org.asciidoctor.Attributes; +import org.asciidoctor.Options; +import org.asciidoctor.SafeMode; + +import java.io.File; +import java.util.*; +import java.util.stream.Stream; + +import static org.asciidoctor.Asciidoctor.Factory.create; + +public class Main { + + private static final String CURRICULUM_FILE_NAME = "curriculumFileName"; + private static final String VERSION_DATE = "versionDate"; + private static final String LANGUAGES = "languages"; + private static final String[] FORMATS = {"html", "pdf"}; + + private static final String LANGUAGE_SEPERATOR = ","; + + private static final String PROJECT_VERSION = "?"; + private static final String SOURCE_DIR = "./docs/"; + private static final String BASE_DIR = SOURCE_DIR; + private static final String OUTPUT_DIR = "./build/"; + + private static final String ADOC = "adoc"; + private static final String HTML = "html"; + private static final String PDF = "pdf"; + + public static void main(final String[] args) { + Objects.requireNonNull(System.getProperty(CURRICULUM_FILE_NAME)); + Objects.requireNonNull(System.getProperty(VERSION_DATE)); + Objects.requireNonNull(System.getProperty(LANGUAGES)); + + final String curriculumFileName = System.getProperty(CURRICULUM_FILE_NAME); + final String versionDate = System.getProperty(VERSION_DATE); + final String[] languages = System.getProperty(LANGUAGES).split(LANGUAGE_SEPERATOR); + + System.out.printf("Source Directory: %s\n", new File(SOURCE_DIR).getAbsolutePath()); + System.out.printf("Base Directory: %s\n", new File(BASE_DIR).getAbsolutePath()); + System.out.printf("Output Directory: %s\n", new File(OUTPUT_DIR).getAbsolutePath()); + System.out.printf("Property CURRICULUM_FILE_NAME: %s\n", curriculumFileName); + System.out.printf("Property VERSION_DATE: %s\n", versionDate); + System.out.printf("Property LANGUAGES: %s\n", String.join(LANGUAGE_SEPERATOR, languages)); + + Stream.of(languages).forEach(language -> convert( + curriculumFileName, + versionDate, + language)); + } + + private static void convert( + final String curriculumFileName, + final String versionDate, + final String language) { + Stream.of(FORMATS).forEach(format -> convert( + curriculumFileName, + versionDate, + language, + format)); + } + + private static void convert( + final String curriculumFileName, + final String versionDate, + final String language, + final String format) { + try (final Asciidoctor asciidoctor = create()) { + final List fileNames = Arrays.asList(curriculumFileName, "index"); + final Attributes attributes = toAttributes( + curriculumFileName, + versionDate, + language); + asciidoctor.convertDirectory( + fileNames.stream() + .map(it -> "%s%s.%s".formatted(SOURCE_DIR, it, ADOC)) + .map(File::new) + .toList(), + Options.builder() + .baseDir(new File(BASE_DIR)) + .backend(toBackend(format)) + .mkDirs(true) + .attributes(attributes) + .standalone(true) + .toDir(new File(OUTPUT_DIR)) + .safe(SafeMode.UNSAFE) + .build()); + renameResultAccordingToLanguage(curriculumFileName, format, language); + } + } + + private static Attributes toAttributes( + final String curriculumFileName, + final String versionDate, + final String language) { + final String fileVersion = "%s - %s".formatted(PROJECT_VERSION, language); + final String documentVersion = "%s-%s".formatted(fileVersion, versionDate); + + final Map attributes = new HashMap<>() {{ + put("icons" , "font"); + put("version-label" , ""); + put("revnumber" , fileVersion); + put("revdate" , versionDate); + put("document-version" , documentVersion); + put("currentDate" , versionDate); + put("language" , language); + put("curriculumFileName", curriculumFileName); + put("debug_adoc" , false); + put("pdf-stylesdir" , "../pdf-theme/themes"); + put("pdf-fontsdir" , "../pdf-theme/fonts"); + put("pdf-style" , "isaqb"); + put("stylesheet" , "../html-theme/adoc-github.css"); + put("stylesheet-dir" , "../html-theme"); + put("allow-uri-read" , true); + }}; + + return Attributes.builder().attributes(attributes).build(); + } + + private static String toBackend(final String format) { + return switch (format) { + case HTML -> "html5"; + case PDF -> PDF; + default -> throw new IllegalArgumentException("Unknown target format %s".formatted(format)); + }; + } + + private static void renameResultAccordingToLanguage( + final String fileName, + final String format, + final String language) { + final File original = new File("%s%s.%s".formatted(OUTPUT_DIR, fileName, format)); + final File renamed = new File("%s%s-%s.%s".formatted(OUTPUT_DIR, fileName, language.toLowerCase(), format)); + if (!original.exists()) { + System.err.printf("Failed to rename result file %s as it does not exist", original.getAbsolutePath()); + } else if (!original.renameTo(renamed)) { + System.err.printf("Failed to rename result file %s to %s", original.getName(), renamed.getName()); + } + original.deleteOnExit(); + } +} From 399b9dd57625d7e119f0f03fa643e308d12f1d50 Mon Sep 17 00:00:00 2001 From: Alexander Schramm Date: Fri, 9 Jun 2023 18:28:19 +0200 Subject: [PATCH 2/8] Update AsciiDoctor to 2.5.10 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9f283f7..a5df1d9 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ repositories { } dependencies { - implementation("org.asciidoctor:asciidoctorj:2.5.8") + implementation("org.asciidoctor:asciidoctorj:2.5.10") implementation("org.asciidoctor:asciidoctorj-pdf:2.3.7") } From eaa85a3414ea3f1babc66d6befd100eaf89c2f44 Mon Sep 17 00:00:00 2001 From: Alexander Schramm Date: Fri, 23 Jun 2023 13:38:22 +0200 Subject: [PATCH 3/8] Correct parameter names 'pdf-stylesdir' to 'pdf-themesdir' und 'pdf-style' to 'pdf-theme' --- src/main/java/org/isaqb/asciidoc/Main.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/isaqb/asciidoc/Main.java b/src/main/java/org/isaqb/asciidoc/Main.java index d776e9c..812ee24 100644 --- a/src/main/java/org/isaqb/asciidoc/Main.java +++ b/src/main/java/org/isaqb/asciidoc/Main.java @@ -108,9 +108,9 @@ private static Attributes toAttributes( put("language" , language); put("curriculumFileName", curriculumFileName); put("debug_adoc" , false); - put("pdf-stylesdir" , "../pdf-theme/themes"); + put("pdf-themesdir" , "../pdf-theme/themes"); put("pdf-fontsdir" , "../pdf-theme/fonts"); - put("pdf-style" , "isaqb"); + put("pdf-theme" , "isaqb"); put("stylesheet" , "../html-theme/adoc-github.css"); put("stylesheet-dir" , "../html-theme"); put("allow-uri-read" , true); From 0fa041578094f15c7aa0aca43a9f5840ee9de99e Mon Sep 17 00:00:00 2001 From: Alexander Schramm Date: Fri, 23 Jun 2023 13:53:34 +0200 Subject: [PATCH 4/8] Add 'buildDocs' Task to ggroup 'documentation' --- build.gradle | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index a5df1d9..a511f10 100644 --- a/build.gradle +++ b/build.gradle @@ -32,8 +32,10 @@ application { apply from: 'scripts/includeLearningObjectives.gradle' -task buildDocs { - description 'Grouping task for generating all languages in several formats' +task buildDocs ( + description: 'Grouping task for generating all languages in several formats', + group: 'documentation' +) { dependsOn "includeLearningObjectives", "run" } From a62d82640b9162cc92bb9a84da5e97c570040628 Mon Sep 17 00:00:00 2001 From: Alexander Schramm Date: Fri, 7 Jul 2023 13:18:44 +0200 Subject: [PATCH 5/8] Set variable project.version according to build environment --- build.gradle | 5 ++++- src/main/java/org/isaqb/asciidoc/Main.java | 13 +++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index a511f10..b3b6092 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,9 @@ plugins { } def group = "org.isaqb" -def version = "1.0-SNAPSHOT" +def releaseVersion = System.getenv("RELEASE_VERSION") +def localVersion = "LocalBuild" +project.version = releaseVersion == null ? localVersion : releaseVersion repositories { mavenCentral() @@ -25,6 +27,7 @@ def languages = ["DE", "EN"] application { mainClass.set("org.isaqb.asciidoc.Main") applicationDefaultJvmArgs = [ + """-DprojectVersion=${project.version}""", """-DcurriculumFileName=${curriculumFileName}""", """-DversionDate=${versionDate}""", """-Dlanguages=${languages.join(',')}"""] diff --git a/src/main/java/org/isaqb/asciidoc/Main.java b/src/main/java/org/isaqb/asciidoc/Main.java index 812ee24..b60b48d 100644 --- a/src/main/java/org/isaqb/asciidoc/Main.java +++ b/src/main/java/org/isaqb/asciidoc/Main.java @@ -13,6 +13,7 @@ public class Main { + private static final String PROJECT_VERSION = "projectVersion"; private static final String CURRICULUM_FILE_NAME = "curriculumFileName"; private static final String VERSION_DATE = "versionDate"; private static final String LANGUAGES = "languages"; @@ -20,7 +21,6 @@ public class Main { private static final String LANGUAGE_SEPERATOR = ","; - private static final String PROJECT_VERSION = "?"; private static final String SOURCE_DIR = "./docs/"; private static final String BASE_DIR = SOURCE_DIR; private static final String OUTPUT_DIR = "./build/"; @@ -30,10 +30,12 @@ public class Main { private static final String PDF = "pdf"; public static void main(final String[] args) { + Objects.requireNonNull(System.getProperty(PROJECT_VERSION)); Objects.requireNonNull(System.getProperty(CURRICULUM_FILE_NAME)); Objects.requireNonNull(System.getProperty(VERSION_DATE)); Objects.requireNonNull(System.getProperty(LANGUAGES)); + final String projectVersion = System.getProperty(PROJECT_VERSION); final String curriculumFileName = System.getProperty(CURRICULUM_FILE_NAME); final String versionDate = System.getProperty(VERSION_DATE); final String[] languages = System.getProperty(LANGUAGES).split(LANGUAGE_SEPERATOR); @@ -41,21 +43,25 @@ public static void main(final String[] args) { System.out.printf("Source Directory: %s\n", new File(SOURCE_DIR).getAbsolutePath()); System.out.printf("Base Directory: %s\n", new File(BASE_DIR).getAbsolutePath()); System.out.printf("Output Directory: %s\n", new File(OUTPUT_DIR).getAbsolutePath()); + System.out.printf("Property PROJECT_VERSION: %s\n", projectVersion); System.out.printf("Property CURRICULUM_FILE_NAME: %s\n", curriculumFileName); System.out.printf("Property VERSION_DATE: %s\n", versionDate); System.out.printf("Property LANGUAGES: %s\n", String.join(LANGUAGE_SEPERATOR, languages)); Stream.of(languages).forEach(language -> convert( + projectVersion, curriculumFileName, versionDate, language)); } private static void convert( + final String projectVersion, final String curriculumFileName, final String versionDate, final String language) { Stream.of(FORMATS).forEach(format -> convert( + projectVersion, curriculumFileName, versionDate, language, @@ -63,6 +69,7 @@ private static void convert( } private static void convert( + final String projectVersion, final String curriculumFileName, final String versionDate, final String language, @@ -70,6 +77,7 @@ private static void convert( try (final Asciidoctor asciidoctor = create()) { final List fileNames = Arrays.asList(curriculumFileName, "index"); final Attributes attributes = toAttributes( + projectVersion, curriculumFileName, versionDate, language); @@ -92,10 +100,11 @@ private static void convert( } private static Attributes toAttributes( + final String projectVersion, final String curriculumFileName, final String versionDate, final String language) { - final String fileVersion = "%s - %s".formatted(PROJECT_VERSION, language); + final String fileVersion = "%s - %s".formatted(projectVersion, language); final String documentVersion = "%s-%s".formatted(fileVersion, versionDate); final Map attributes = new HashMap<>() {{ From 379939aae5475689e0134a516033808c10dbeb7a Mon Sep 17 00:00:00 2001 From: Alexander Schramm Date: Fri, 7 Jul 2023 13:28:31 +0200 Subject: [PATCH 6/8] Fix warning by adding missing JVM arguments --- build.gradle | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b3b6092..6a59a05 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,9 @@ application { """-DprojectVersion=${project.version}""", """-DcurriculumFileName=${curriculumFileName}""", """-DversionDate=${versionDate}""", - """-Dlanguages=${languages.join(',')}"""] + """-Dlanguages=${languages.join(',')}""", + """--add-opens""", """java.base/sun.nio.ch=ALL-UNNAMED""", + """--add-opens""", """java.base/java.io=ALL-UNNAMED"""] } apply from: 'scripts/includeLearningObjectives.gradle' From c8daf769df5617142dfeffaac2f0277323dfa31c Mon Sep 17 00:00:00 2001 From: Alexander Schramm Date: Fri, 7 Jul 2023 14:07:58 +0200 Subject: [PATCH 7/8] Embed images in HTML files --- src/main/java/org/isaqb/asciidoc/Main.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/isaqb/asciidoc/Main.java b/src/main/java/org/isaqb/asciidoc/Main.java index b60b48d..b4d8860 100644 --- a/src/main/java/org/isaqb/asciidoc/Main.java +++ b/src/main/java/org/isaqb/asciidoc/Main.java @@ -122,6 +122,7 @@ private static Attributes toAttributes( put("pdf-theme" , "isaqb"); put("stylesheet" , "../html-theme/adoc-github.css"); put("stylesheet-dir" , "../html-theme"); + put("data-uri" , true); put("allow-uri-read" , true); }}; From cbe6b8ad0b386bbd8c9d31c40bf1c630d384545c Mon Sep 17 00:00:00 2001 From: Alexander Schramm Date: Fri, 18 Aug 2023 16:38:02 +0200 Subject: [PATCH 8/8] Fix issues found in review (see PR #141 for comments) --- build.gradle | 17 +++--- src/main/java/org/isaqb/asciidoc/Main.java | 61 ++++++++++++---------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/build.gradle b/build.gradle index 6a59a05..9764091 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,4 @@ import java.text.SimpleDateFormat -import java.util.* plugins { id "java" @@ -10,6 +9,9 @@ def group = "org.isaqb" def releaseVersion = System.getenv("RELEASE_VERSION") def localVersion = "LocalBuild" project.version = releaseVersion == null ? localVersion : releaseVersion +def curriculumFileName = "curriculum-template" +def versionDate = new SimpleDateFormat("yyyyMMdd").format(new Date()) +def languages = ["DE", "EN"] repositories { mavenCentral() @@ -17,13 +19,9 @@ repositories { dependencies { implementation("org.asciidoctor:asciidoctorj:2.5.10") - implementation("org.asciidoctor:asciidoctorj-pdf:2.3.7") + implementation("org.asciidoctor:asciidoctorj-pdf:2.3.9") } -def curriculumFileName = "curriculum-template" -def versionDate = new SimpleDateFormat("yyyyMMdd").format(new Date()) -def languages = ["DE", "EN"] - application { mainClass.set("org.isaqb.asciidoc.Main") applicationDefaultJvmArgs = [ @@ -37,10 +35,9 @@ application { apply from: 'scripts/includeLearningObjectives.gradle' -task buildDocs ( - description: 'Grouping task for generating all languages in several formats', - group: 'documentation' -) { +tasks.register('buildDocs') { + description = 'Grouping task for generating all languages in several formats' + group = 'documentation' dependsOn "includeLearningObjectives", "run" } diff --git a/src/main/java/org/isaqb/asciidoc/Main.java b/src/main/java/org/isaqb/asciidoc/Main.java index b4d8860..22d3d87 100644 --- a/src/main/java/org/isaqb/asciidoc/Main.java +++ b/src/main/java/org/isaqb/asciidoc/Main.java @@ -6,7 +6,10 @@ import org.asciidoctor.SafeMode; import java.io.File; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; import java.util.stream.Stream; import static org.asciidoctor.Asciidoctor.Factory.create; @@ -15,6 +18,7 @@ public class Main { private static final String PROJECT_VERSION = "projectVersion"; private static final String CURRICULUM_FILE_NAME = "curriculumFileName"; + private static final String INDEX_FILE_NAME = "index"; private static final String VERSION_DATE = "versionDate"; private static final String LANGUAGES = "languages"; private static final String[] FORMATS = {"html", "pdf"}; @@ -27,7 +31,9 @@ public class Main { private static final String ADOC = "adoc"; private static final String HTML = "html"; + private static final String HTML5 = "html5"; private static final String PDF = "pdf"; + private static final String ENGLISH = "EN"; public static void main(final String[] args) { Objects.requireNonNull(System.getProperty(PROJECT_VERSION)); @@ -40,52 +46,49 @@ public static void main(final String[] args) { final String versionDate = System.getProperty(VERSION_DATE); final String[] languages = System.getProperty(LANGUAGES).split(LANGUAGE_SEPERATOR); - System.out.printf("Source Directory: %s\n", new File(SOURCE_DIR).getAbsolutePath()); - System.out.printf("Base Directory: %s\n", new File(BASE_DIR).getAbsolutePath()); - System.out.printf("Output Directory: %s\n", new File(OUTPUT_DIR).getAbsolutePath()); - System.out.printf("Property PROJECT_VERSION: %s\n", projectVersion); - System.out.printf("Property CURRICULUM_FILE_NAME: %s\n", curriculumFileName); - System.out.printf("Property VERSION_DATE: %s\n", versionDate); - System.out.printf("Property LANGUAGES: %s\n", String.join(LANGUAGE_SEPERATOR, languages)); - - Stream.of(languages).forEach(language -> convert( + Stream.of(languages).forEach(language -> convertInLanguage( + language, projectVersion, curriculumFileName, - versionDate, - language)); + versionDate + )); + convertInLanguage( + ENGLISH, + projectVersion, + INDEX_FILE_NAME, + versionDate); } - private static void convert( + private static void convertInLanguage( + final String language, final String projectVersion, final String curriculumFileName, - final String versionDate, - final String language) { - Stream.of(FORMATS).forEach(format -> convert( - projectVersion, + final String versionDate) { + Stream.of(FORMATS).forEach(format -> convertInFormat( + format, projectVersion, curriculumFileName, versionDate, - language, - format)); + language + )); } - private static void convert( + private static void convertInFormat( + final String format, final String projectVersion, final String curriculumFileName, final String versionDate, - final String language, - final String format) { + final String language) { try (final Asciidoctor asciidoctor = create()) { - final List fileNames = Arrays.asList(curriculumFileName, "index"); final Attributes attributes = toAttributes( projectVersion, curriculumFileName, versionDate, language); asciidoctor.convertDirectory( - fileNames.stream() - .map(it -> "%s%s.%s".formatted(SOURCE_DIR, it, ADOC)) - .map(File::new) - .toList(), + List.of(new File("%s%s.%s".formatted( + SOURCE_DIR, + curriculumFileName, + ADOC))), Options.builder() .baseDir(new File(BASE_DIR)) .backend(toBackend(format)) @@ -131,7 +134,7 @@ private static Attributes toAttributes( private static String toBackend(final String format) { return switch (format) { - case HTML -> "html5"; + case HTML -> HTML5; case PDF -> PDF; default -> throw new IllegalArgumentException("Unknown target format %s".formatted(format)); }; @@ -146,7 +149,7 @@ private static void renameResultAccordingToLanguage( if (!original.exists()) { System.err.printf("Failed to rename result file %s as it does not exist", original.getAbsolutePath()); } else if (!original.renameTo(renamed)) { - System.err.printf("Failed to rename result file %s to %s", original.getName(), renamed.getName()); + System.err.printf("Failed to rename result file %s to %s%n", original.getName(), renamed.getName()); } original.deleteOnExit(); }