Skip to content

Commit cbdbb27

Browse files
committed
HHH-18654 - Change setting docs to use an asciidoc section per setting
1 parent c9621aa commit cbdbb27

File tree

3 files changed

+14
-28
lines changed

3 files changed

+14
-28
lines changed

local-build-plugins/src/main/java/org/hibernate/orm/properties/AsciiDocWriter.java

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ private static void write(
6868
for ( SettingDescriptor settingDescriptor : sectionSettingDescriptors ) {
6969
// write an anchor in the form `[[{anchorNameBase}-{settingName}]]`
7070
tryToWriteLine( writer, "[[", anchorNameBase, "-", settingDescriptor.getName(), "]]" );
71-
72-
writeSettingName( settingDescriptor, writer );
73-
writer.write( "::\n" );
71+
tryToWriteLine( writer, "==== ", settingName( settingDescriptor ) );
7472

7573
writeMetadata( settingDescriptor, writer );
7674

@@ -88,7 +86,6 @@ private static void writeMetadata(SettingDescriptor settingDescriptor, FileWrite
8886
return;
8987
}
9088

91-
writer.write( "+\n" );
9289
writer.write( "****\n" );
9390

9491
writer.write(
@@ -125,27 +122,24 @@ private static void writeMetadata(SettingDescriptor settingDescriptor, FileWrite
125122
writer.write( settingDescriptor.getApiNote() + "\n\n" );
126123
}
127124

128-
writer.write( "****\n+\n" );
125+
writer.write( "****\n\n" );
129126
}
130127

131-
private static void writeSettingName(SettingDescriptor settingDescriptor, FileWriter writer) throws IOException {
132-
writer.write( "`" );
133-
if ( settingDescriptor.getLifecycleDetails().isDeprecated() ) {
134-
writer.write( "[.line-through]#" );
135-
}
136-
else {
137-
writer.write( '*' );
138-
}
139-
140-
writer.write( settingDescriptor.getName() );
141-
128+
private static String settingName(SettingDescriptor settingDescriptor) {
142129
if ( settingDescriptor.getLifecycleDetails().isDeprecated() ) {
143-
writer.write( '#' );
130+
return String.format(
131+
Locale.ROOT,
132+
"`[.line-through]#%s#`",
133+
settingDescriptor.getName()
134+
);
144135
}
145136
else {
146-
writer.write( '*' );
137+
return String.format(
138+
Locale.ROOT,
139+
"`%s`",
140+
settingDescriptor.getName()
141+
);
147142
}
148-
writer.write( '`' );
149143
}
150144

151145
private static void tryToWriteLine(Writer writer, String prefix, String value, String... other) {

local-build-plugins/src/main/java/org/hibernate/orm/properties/jdk11/DomToAsciidocConverter.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ private void visitElement(Element element) {
9393
}
9494

9595
private void visitDiv(Element div) {
96-
if ( converted.length() != 0 ) {
97-
converted.append( "\n+\n" );
98-
}
9996
for ( Node childNode : div.childNodes() ) {
10097
visitNode( childNode );
10198
}
@@ -129,7 +126,6 @@ private void visitUl(Element ul) {
129126
if ( converted.lastIndexOf( "\n" ) != converted.length() - 1 ) {
130127
converted.append( '\n' );
131128
}
132-
converted.append( "+\n" );
133129
for ( Node childNode : ul.childNodes() ) {
134130
visitNode( childNode );
135131
}

local-build-plugins/src/main/java/org/hibernate/orm/properties/jdk17/JavadocToAsciidocConverter.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,9 @@ private void visitElement(Element element) {
195195
}
196196

197197
private void visitDiv(Element div) {
198-
if ( converted.length() != 0 ) {
199-
converted.append( "\n+\n" );
200-
}
201198
boolean deprecation = div.hasClass( "deprecationBlock" );
202199
if ( deprecation ) {
203-
converted.append( "+\n[WARNING]\n====\n" );
200+
converted.append( "[WARNING]\n====\n" );
204201
}
205202
for ( Node childNode : div.childNodes() ) {
206203
visitNode( childNode );
@@ -238,7 +235,6 @@ private void visitUl(Element ul) {
238235
if ( converted.lastIndexOf( "\n" ) != converted.length() - 1 ) {
239236
converted.append( '\n' );
240237
}
241-
converted.append( "+\n" );
242238
for ( Node childNode : ul.childNodes() ) {
243239
visitNode( childNode );
244240
}

0 commit comments

Comments
 (0)