Skip to content

Commit 9882333

Browse files
committed
feat: fj-doc-base, new attribute 'class' for element <para>, <phrase> <h>
1 parent 5d66953 commit 9882333

File tree

13 files changed

+107
-7
lines changed

13 files changed

+107
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- fj-doc-base, new attribute 'class' for element <para>, <phrase>, <h>
13+
1014
### Fixed
1115

1216
- fj-doc-freemarker, html handler now renders fore color for phrase.

fj-doc-base-kotlin/src/main/java/org/fugerit/java/doc/base/kotlin/dsl/H.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ class H( text: String = "" ) : HelperDSL.TagWithText( "h" ) {
116116
* @return the value for the whiteSpaceCollapse attribute.
117117
*/
118118
fun whiteSpaceCollapse( value: Boolean ): H = whiteSpaceCollapsType( this, "white-space-collapse", value )
119+
/**
120+
* Function handling class attribute of the H with specific check on type.
121+
* @return the value for the class attribute.
122+
*/
123+
fun class( value: String ): H = classType( this, "class", value )
119124
/**
120125
* Function handling headLevel attribute of the H with specific check on type.
121126
* @return the value for the headLevel attribute.

fj-doc-base-kotlin/src/main/java/org/fugerit/java/doc/base/kotlin/dsl/HelperDSL.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ class HelperDSL {
147147
protected fun <T : Element> textIndentType( tag : T, name : String, v: Int) : T = setAtt( tag, name, v, checkFun4 )
148148
protected fun <T : Element> spaceType( tag : T, name : String, v: Int) : T = setAtt( tag, name, v, checkFun4 )
149149
protected fun <T : Element> whiteSpaceCollapsType( tag : T, name : String, v: Boolean) : T = setAtt( tag, name, v )
150+
protected fun <T : Element> classType( tag : T, name : String, v: String) : T = setAtt( tag, name, v )
150151
protected fun <T : Element> columnsType( tag : T, name : String, v: Int) : T = setAtt( tag, name, v, checkFun9 )
151152
protected fun <T : Element> percentageType( tag : T, name : String, v: Int) : T = setAtt( tag, name, v, checkFun10 )
152153
protected fun <T : Element> tableRenderModeType( tag : T, name : String, v: String) : T = setAtt( tag, name, v, checkFun11 )

fj-doc-base-kotlin/src/main/java/org/fugerit/java/doc/base/kotlin/dsl/Para.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,10 @@ class Para( text: String = "" ) : HelperDSL.TagWithText( "para" ) {
116116
* @return the value for the whiteSpaceCollapse attribute.
117117
*/
118118
fun whiteSpaceCollapse( value: Boolean ): Para = whiteSpaceCollapsType( this, "white-space-collapse", value )
119+
/**
120+
* Function handling class attribute of the Para with specific check on type.
121+
* @return the value for the class attribute.
122+
*/
123+
fun class( value: String ): Para = classType( this, "class", value )
119124

120125
}

fj-doc-base-kotlin/src/main/java/org/fugerit/java/doc/base/kotlin/dsl/Phrase.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,10 @@ class Phrase( text: String = "" ) : HelperDSL.TagWithText( "phrase" ) {
5555
* @return the value for the anchor attribute.
5656
*/
5757
fun anchor( value: String ): Phrase = setAtt( this, "anchor", value )
58+
/**
59+
* Function handling class attribute of the Phrase with specific check on type.
60+
* @return the value for the class attribute.
61+
*/
62+
fun class( value: String ): Phrase = classType( this, "class", value )
5863

5964
}

fj-doc-base/src/main/docs/doc_xsd_config_ref.html

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,17 @@ <h1 style="font-weight: bold;">Reference xsd documentation for Venus - Fugerit
12631263
<td id="cell_15_2" style=" width: 40%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
12641264
<span >whiteSpaceCollapsType , base : boolean</span>
12651265
</td>
1266+
</tr>
1267+
<tr>
1268+
<td id="cell_16_0" style=" width: 20%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
1269+
<span >class</span>
1270+
</td>
1271+
<td id="cell_16_1" style=" width: 40%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
1272+
<span >Only for HTML, class</span>
1273+
</td>
1274+
<td id="cell_16_2" style=" width: 40%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
1275+
<span >classType , base : string</span>
1276+
</td>
12661277
</tr>
12671278
</tbody>
12681279
</table>
@@ -2054,6 +2065,17 @@ <h1 style="font-weight: bold;">Reference xsd documentation for Venus - Fugerit
20542065
<td id="cell_7_2" style=" width: 40%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
20552066
<span >string</span>
20562067
</td>
2068+
</tr>
2069+
<tr>
2070+
<td id="cell_8_0" style=" width: 20%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
2071+
<span >class</span>
2072+
</td>
2073+
<td id="cell_8_1" style=" width: 40%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
2074+
<span >Only for HTML, class</span>
2075+
</td>
2076+
<td id="cell_8_2" style=" width: 40%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
2077+
<span >classType , base : string</span>
2078+
</td>
20572079
</tr>
20582080
</tbody>
20592081
</table>
@@ -2398,12 +2420,23 @@ <h1 style="font-weight: bold;">Reference xsd documentation for Venus - Fugerit
23982420
</tr>
23992421
<tr>
24002422
<td id="cell_16_0" style=" width: 20%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
2401-
<span >head-level</span>
2423+
<span >class</span>
24022424
</td>
24032425
<td id="cell_16_1" style=" width: 40%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
2404-
<span >The level of the headings, from 1 (most relevant) to 7 (less relevant) (roughly comparable to a HTML 'h1', 'h2' etc.)</span>
2426+
<span >Only for HTML, class</span>
24052427
</td>
24062428
<td id="cell_16_2" style=" width: 40%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
2429+
<span >classType , base : string</span>
2430+
</td>
2431+
</tr>
2432+
<tr>
2433+
<td id="cell_17_0" style=" width: 20%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
2434+
<span >head-level</span>
2435+
</td>
2436+
<td id="cell_17_1" style=" width: 40%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
2437+
<span >The level of the headings, from 1 (most relevant) to 7 (less relevant) (roughly comparable to a HTML 'h1', 'h2' etc.)</span>
2438+
</td>
2439+
<td id="cell_17_2" style=" width: 40%; border-top: 1px solid black; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 2px;">
24072440
<span >headLevelType , base : int , minInclusive : 1 , maxInclusive : 7</span>
24082441
</td>
24092442
</tr>

fj-doc-base/src/main/java/org/fugerit/java/doc/base/model/DocPara.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ public class DocPara extends DocContainer implements DocStyle {
107107

108108
@Getter @Setter private String type;
109109

110+
@Getter @Setter private String className;
111+
110112
public boolean isNotWhiteSpaceCollapse() {
111113
return BooleanUtils.BOOLEAN_FALSE.equalsIgnoreCase( this.getWhiteSpaceCollapse() );
112114
}

fj-doc-base/src/main/java/org/fugerit/java/doc/base/model/DocPhrase.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public DocPhrase() {
3535
@Getter @Setter private String anchor;
3636

3737
@Getter @Setter private String whiteSpaceCollapse;
38+
39+
@Getter @Setter private String className;
3840

3941
@Getter @Setter private int originalStyle; // style with unset value
4042

fj-doc-base/src/main/java/org/fugerit/java/doc/base/parser/DocParserContext.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,9 @@ private static void valuePhrase( DocPhrase docPhrase, Properties props ) {
475475
// foreground color
476476
String foreColor = props.getProperty( "fore-color" );
477477
docPhrase.setForeColor( foreColor );
478+
// class name (only for html)
479+
String className = props.getProperty( "class" );
480+
docPhrase.setClassName( className );
478481
//leading
479482
String leading = props.getProperty( "leading" );
480483
if ( leading != null ) {
@@ -548,6 +551,9 @@ private static void valuePara( DocPara docPara, Properties props, boolean headin
548551
if ( StringUtils.isNotEmpty( whiteSpaceCollapse ) ) {
549552
docPara.setWhiteSpaceCollapse(whiteSpaceCollapse);
550553
}
554+
// class name (only for html)
555+
String className = props.getProperty( "class" );
556+
docPara.setClassName( className );
551557
}
552558

553559

fj-doc-base/src/main/resources/META-INF/native-image/org.fugerit.java/fj-doc-base/reflect-config.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,9 @@
507507
}, {
508508
"name" : "getClass",
509509
"parameterTypes" : [ ]
510+
}, {
511+
"name" : "getClassName",
512+
"parameterTypes" : [ ]
510513
}, {
511514
"name" : "getFontName",
512515
"parameterTypes" : [ ]
@@ -558,6 +561,9 @@
558561
}, {
559562
"name" : "setBackColor",
560563
"parameterTypes" : [ "java.lang.String" ]
564+
}, {
565+
"name" : "setClassName",
566+
"parameterTypes" : [ "java.lang.String" ]
561567
}, {
562568
"name" : "setFontName",
563569
"parameterTypes" : [ "java.lang.String" ]
@@ -1431,6 +1437,9 @@
14311437
}, {
14321438
"name" : "getClass",
14331439
"parameterTypes" : [ ]
1440+
}, {
1441+
"name" : "getClassName",
1442+
"parameterTypes" : [ ]
14341443
}, {
14351444
"name" : "getFontName",
14361445
"parameterTypes" : [ ]
@@ -1485,6 +1494,9 @@
14851494
}, {
14861495
"name" : "setBackColor",
14871496
"parameterTypes" : [ "java.lang.String" ]
1497+
}, {
1498+
"name" : "setClassName",
1499+
"parameterTypes" : [ "java.lang.String" ]
14881500
}, {
14891501
"name" : "setFontName",
14901502
"parameterTypes" : [ "java.lang.String" ]
@@ -1602,6 +1614,9 @@
16021614
}, {
16031615
"name" : "getClass",
16041616
"parameterTypes" : [ ]
1617+
}, {
1618+
"name" : "getClassName",
1619+
"parameterTypes" : [ ]
16051620
}, {
16061621
"name" : "getElementList",
16071622
"parameterTypes" : [ ]
@@ -1680,6 +1695,9 @@
16801695
}, {
16811696
"name" : "setBackColor",
16821697
"parameterTypes" : [ "java.lang.String" ]
1698+
}, {
1699+
"name" : "setClassName",
1700+
"parameterTypes" : [ "java.lang.String" ]
16831701
}, {
16841702
"name" : "setFontName",
16851703
"parameterTypes" : [ "java.lang.String" ]
@@ -1764,6 +1782,9 @@
17641782
}, {
17651783
"name" : "getClass",
17661784
"parameterTypes" : [ ]
1785+
}, {
1786+
"name" : "getClassName",
1787+
"parameterTypes" : [ ]
17671788
}, {
17681789
"name" : "getFontName",
17691790
"parameterTypes" : [ ]
@@ -1815,6 +1836,9 @@
18151836
}, {
18161837
"name" : "setBackColor",
18171838
"parameterTypes" : [ "java.lang.String" ]
1839+
}, {
1840+
"name" : "setClassName",
1841+
"parameterTypes" : [ "java.lang.String" ]
18181842
}, {
18191843
"name" : "setFontName",
18201844
"parameterTypes" : [ "java.lang.String" ]

0 commit comments

Comments
 (0)