From cbdbb273bfc49b811650631d3cc8245b5ea17470 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Tue, 24 Sep 2024 17:36:24 -0500 Subject: [PATCH] HHH-18654 - Change setting docs to use an asciidoc section per setting --- .../orm/properties/AsciiDocWriter.java | 32 ++++++++----------- .../jdk11/DomToAsciidocConverter.java | 4 --- .../jdk17/JavadocToAsciidocConverter.java | 6 +--- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/properties/AsciiDocWriter.java b/local-build-plugins/src/main/java/org/hibernate/orm/properties/AsciiDocWriter.java index 3004ea90be..ebf99d1182 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/properties/AsciiDocWriter.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/properties/AsciiDocWriter.java @@ -68,9 +68,7 @@ public class AsciiDocWriter { for ( SettingDescriptor settingDescriptor : sectionSettingDescriptors ) { // write an anchor in the form `[[{anchorNameBase}-{settingName}]]` tryToWriteLine( writer, "[[", anchorNameBase, "-", settingDescriptor.getName(), "]]" ); - - writeSettingName( settingDescriptor, writer ); - writer.write( "::\n" ); + tryToWriteLine( writer, "==== ", settingName( settingDescriptor ) ); writeMetadata( settingDescriptor, writer ); @@ -88,7 +86,6 @@ public class AsciiDocWriter { return; } - writer.write( "+\n" ); writer.write( "****\n" ); writer.write( @@ -125,27 +122,24 @@ public class AsciiDocWriter { writer.write( settingDescriptor.getApiNote() + "\n\n" ); } - writer.write( "****\n+\n" ); + writer.write( "****\n\n" ); } - private static void writeSettingName(SettingDescriptor settingDescriptor, FileWriter writer) throws IOException { - writer.write( "`" ); + private static String settingName(SettingDescriptor settingDescriptor) { if ( settingDescriptor.getLifecycleDetails().isDeprecated() ) { - writer.write( "[.line-through]#" ); + return String.format( + Locale.ROOT, + "`[.line-through]#%s#`", + settingDescriptor.getName() + ); } else { - writer.write( '*' ); + return String.format( + Locale.ROOT, + "`%s`", + settingDescriptor.getName() + ); } - - writer.write( settingDescriptor.getName() ); - - if ( settingDescriptor.getLifecycleDetails().isDeprecated() ) { - writer.write( '#' ); - } - else { - writer.write( '*' ); - } - writer.write( '`' ); } private static void tryToWriteLine(Writer writer, String prefix, String value, String... other) { diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/properties/jdk11/DomToAsciidocConverter.java b/local-build-plugins/src/main/java/org/hibernate/orm/properties/jdk11/DomToAsciidocConverter.java index c768536928..19a8e7b388 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/properties/jdk11/DomToAsciidocConverter.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/properties/jdk11/DomToAsciidocConverter.java @@ -93,9 +93,6 @@ class DomToAsciidocConverter { } private void visitDiv(Element div) { - if ( converted.length() != 0 ) { - converted.append( "\n+\n" ); - } for ( Node childNode : div.childNodes() ) { visitNode( childNode ); } @@ -129,7 +126,6 @@ class DomToAsciidocConverter { if ( converted.lastIndexOf( "\n" ) != converted.length() - 1 ) { converted.append( '\n' ); } - converted.append( "+\n" ); for ( Node childNode : ul.childNodes() ) { visitNode( childNode ); } diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/properties/jdk17/JavadocToAsciidocConverter.java b/local-build-plugins/src/main/java/org/hibernate/orm/properties/jdk17/JavadocToAsciidocConverter.java index def21e395c..456cacffbc 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/properties/jdk17/JavadocToAsciidocConverter.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/properties/jdk17/JavadocToAsciidocConverter.java @@ -195,12 +195,9 @@ public class JavadocToAsciidocConverter { } private void visitDiv(Element div) { - if ( converted.length() != 0 ) { - converted.append( "\n+\n" ); - } boolean deprecation = div.hasClass( "deprecationBlock" ); if ( deprecation ) { - converted.append( "+\n[WARNING]\n====\n" ); + converted.append( "[WARNING]\n====\n" ); } for ( Node childNode : div.childNodes() ) { visitNode( childNode ); @@ -238,7 +235,6 @@ public class JavadocToAsciidocConverter { if ( converted.lastIndexOf( "\n" ) != converted.length() - 1 ) { converted.append( '\n' ); } - converted.append( "+\n" ); for ( Node childNode : ul.childNodes() ) { visitNode( childNode ); }