From cf173715c28c6ac820df44009dd5bc3222af46fb Mon Sep 17 00:00:00 2001
From: ulrich
Date: Sun, 10 Nov 2024 16:14:57 +0000
Subject: [PATCH] an AsciidoctorJ Version 3 angepasst

---
 src/de/uhilger/neon/adoc/AdocWorker.java |   32 ++++++++++++++------------------
 1 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/src/de/uhilger/neon/adoc/AdocWorker.java b/src/de/uhilger/neon/adoc/AdocWorker.java
index 6be83bf..4719032 100644
--- a/src/de/uhilger/neon/adoc/AdocWorker.java
+++ b/src/de/uhilger/neon/adoc/AdocWorker.java
@@ -18,11 +18,10 @@
 package de.uhilger.neon.adoc;
 
 import java.io.File;
-import java.util.Map;
 import org.asciidoctor.Asciidoctor;
 import static org.asciidoctor.Asciidoctor.Factory.create;
-import static org.asciidoctor.AttributesBuilder.attributes;
-import static org.asciidoctor.OptionsBuilder.options;
+import org.asciidoctor.Attributes;
+import org.asciidoctor.Options;
 import org.asciidoctor.SafeMode;
 
 /**
@@ -48,43 +47,40 @@
    * nach PDF transformiert werden soll
    */
   public void transform(String fileName, String backend) {    
-    //logger.fine("fileName: " + fileName + ", backend: " + backend);
-    Map<String, Object> attributes;
+    Attributes attributes;
     File outFile = new File(fileName);
     String thisDirName = outFile.getParent();
     File pdfStyles = new File(outFile.getParentFile(), "custom-theme.yml");
     if(pdfStyles.exists()) {
-      attributes = attributes()
+      attributes = Attributes.builder()
               .attribute("pdf-themesdir", thisDirName)
               .attribute("pdf-theme","custom")
               .attribute("pdf-fontsdir", thisDirName + "/fonts")
               .attribute("allow-uri-read")
               .sourceHighlighter("highlightjs")
-              .asMap();
+              .build();
     } else {
-      attributes = attributes()
+      attributes = Attributes.builder()
               .sourceHighlighter("highlightjs")
-              .asMap();
+              .build();
     }
-    Map<String, Object> options;
+    Options options;
     if(null != backend) {
-      options = options().inPlace(false)
+      options = Options.builder()
+              .inPlace(false)
               .safe(SafeMode.SERVER)
-              .backend(backend).attributes(attributes).asMap();
+              .backend(backend).attributes(attributes).build();
       
     } else {
-      options = options().inPlace(false)
+      options = Options.builder()
+              .inPlace(false)
               .safe(SafeMode.SERVER)
-              .attributes(attributes).asMap();
+              .attributes(attributes).build();
     }
     
     File adcf = new File(fileName);
-    //logger.fine("before asciidoctor create, adcf: " + adcf.getAbsolutePath());
     Asciidoctor asciidoctor = create();    
-    //logger.fine("asciidoctor created.");
     asciidoctor.requireLibrary("asciidoctor-diagram");
-    //logger.fine("asciidoctor requireLibrary diagram passed.");
-    //logger.fine("calling asciidoctor.convert for file " + adcf.getAbsolutePath());
     asciidoctor.convertFile(adcf, options);    
   }  
 }

--
Gitblit v1.9.3