HHH-18654 - Change setting docs to use an asciidoc section per setting

This commit is contained in:
Steve Ebersole 2024-09-24 17:36:24 -05:00
parent c9621aa9e2
commit cbdbb273bf
3 changed files with 14 additions and 28 deletions

View File

@ -68,9 +68,7 @@ public class AsciiDocWriter {
for ( SettingDescriptor settingDescriptor : sectionSettingDescriptors ) { for ( SettingDescriptor settingDescriptor : sectionSettingDescriptors ) {
// write an anchor in the form `[[{anchorNameBase}-{settingName}]]` // write an anchor in the form `[[{anchorNameBase}-{settingName}]]`
tryToWriteLine( writer, "[[", anchorNameBase, "-", settingDescriptor.getName(), "]]" ); tryToWriteLine( writer, "[[", anchorNameBase, "-", settingDescriptor.getName(), "]]" );
tryToWriteLine( writer, "==== ", settingName( settingDescriptor ) );
writeSettingName( settingDescriptor, writer );
writer.write( "::\n" );
writeMetadata( settingDescriptor, writer ); writeMetadata( settingDescriptor, writer );
@ -88,7 +86,6 @@ public class AsciiDocWriter {
return; return;
} }
writer.write( "+\n" );
writer.write( "****\n" ); writer.write( "****\n" );
writer.write( writer.write(
@ -125,27 +122,24 @@ public class AsciiDocWriter {
writer.write( settingDescriptor.getApiNote() + "\n\n" ); writer.write( settingDescriptor.getApiNote() + "\n\n" );
} }
writer.write( "****\n+\n" ); writer.write( "****\n\n" );
} }
private static void writeSettingName(SettingDescriptor settingDescriptor, FileWriter writer) throws IOException { private static String settingName(SettingDescriptor settingDescriptor) {
writer.write( "`" );
if ( settingDescriptor.getLifecycleDetails().isDeprecated() ) { if ( settingDescriptor.getLifecycleDetails().isDeprecated() ) {
writer.write( "[.line-through]#" ); return String.format(
Locale.ROOT,
"`[.line-through]#%s#`",
settingDescriptor.getName()
);
} }
else { 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) { private static void tryToWriteLine(Writer writer, String prefix, String value, String... other) {

View File

@ -93,9 +93,6 @@ class DomToAsciidocConverter {
} }
private void visitDiv(Element div) { private void visitDiv(Element div) {
if ( converted.length() != 0 ) {
converted.append( "\n+\n" );
}
for ( Node childNode : div.childNodes() ) { for ( Node childNode : div.childNodes() ) {
visitNode( childNode ); visitNode( childNode );
} }
@ -129,7 +126,6 @@ class DomToAsciidocConverter {
if ( converted.lastIndexOf( "\n" ) != converted.length() - 1 ) { if ( converted.lastIndexOf( "\n" ) != converted.length() - 1 ) {
converted.append( '\n' ); converted.append( '\n' );
} }
converted.append( "+\n" );
for ( Node childNode : ul.childNodes() ) { for ( Node childNode : ul.childNodes() ) {
visitNode( childNode ); visitNode( childNode );
} }

View File

@ -195,12 +195,9 @@ public class JavadocToAsciidocConverter {
} }
private void visitDiv(Element div) { private void visitDiv(Element div) {
if ( converted.length() != 0 ) {
converted.append( "\n+\n" );
}
boolean deprecation = div.hasClass( "deprecationBlock" ); boolean deprecation = div.hasClass( "deprecationBlock" );
if ( deprecation ) { if ( deprecation ) {
converted.append( "+\n[WARNING]\n====\n" ); converted.append( "[WARNING]\n====\n" );
} }
for ( Node childNode : div.childNodes() ) { for ( Node childNode : div.childNodes() ) {
visitNode( childNode ); visitNode( childNode );
@ -238,7 +235,6 @@ public class JavadocToAsciidocConverter {
if ( converted.lastIndexOf( "\n" ) != converted.length() - 1 ) { if ( converted.lastIndexOf( "\n" ) != converted.length() - 1 ) {
converted.append( '\n' ); converted.append( '\n' );
} }
converted.append( "+\n" );
for ( Node childNode : ul.childNodes() ) { for ( Node childNode : ul.childNodes() ) {
visitNode( childNode ); visitNode( childNode );
} }