Disable automatic logging of invalid refs and enable it via verbose mode from CLI
MODIFY
asciidoctorj-core/src/main/java/org/asciidoctor/cli/AsciidoctorInvoker.java
asciidoctorj-core/src/main/java/org/asciidoctor/cli/AsciidoctorInvoker.java
@@ -40,6 +40,10 @@ public class AsciidoctorInvoker {
return;
}
+ if (asciidoctorCliOptions.isVerbose()) {
+ JRubyRuntimeContext.get().evalScriptlet("$VERBOSE=true");
+ }
+
List<File> inputFiles = getInputFiles(asciidoctorCliOptions);
if (inputFiles.isEmpty()) {

MODIFY
asciidoctorj-core/src/main/resources/org/asciidoctor/internal/asciidoctorclass.rb
asciidoctorj-core/src/main/resources/org/asciidoctor/internal/asciidoctorclass.rb
-# Set the global variable VERBOSE to true to get invalid refs into the log
-#$VERBOSE=true
-
module AsciidoctorJ
include_package 'org.asciidoctor'
module Extensions

MODIFY
asciidoctorj-core/src/test/java/org/asciidoctor/WhenAsciidoctorLogsToConsole.java
asciidoctorj-core/src/test/java/org/asciidoctor/WhenAsciidoctorLogsToConsole.java
@@ -2,6 +2,7 @@ package org.asciidoctor;
import org.asciidoctor.ast.Cursor;
import org.asciidoctor.internal.JRubyAsciidoctor;
+import org.asciidoctor.internal.JRubyRuntimeContext;
import org.asciidoctor.log.LogHandler;
import org.asciidoctor.log.LogRecord;
import org.asciidoctor.log.TestLogHandlerService;
@@ -135,6 +136,9 @@ public class WhenAsciidoctorLogsToConsole {
};
asciidoctor.registerLogHandler(logHandler);
+ // Asciidoctor currently only logs invalid refs if this global var is set
+ JRubyRuntimeContext.get().evalScriptlet("$VERBOSE=true");
+
File inputFile = classpath.getResource("documentwithinvalidrefs.adoc");
String renderContent = asciidoctor.renderFile(inputFile,
options()

Disable automatic logging of invalid refs and enable it via verbose mode from CLI