@@ -54,6 +54,10 @@ public final class HelpPrinter {
5454
5555 private static final Map <String , String []> EXAMPLES_MAP = new HashMap <>();
5656
57+ private static final String INDENTATION = " " ;
58+
59+ private static StringBuilder htmlTable = new StringBuilder ();
60+
5761 private HelpPrinter () {
5862 // no instances
5963 }
@@ -91,9 +95,12 @@ public static void print(final ObjectFactory<?> factory,
9195 final List <String > keyWords = new ArrayList <>(factory .keySet ());
9296 Collections .sort (keyWords );
9397 loadExamples ();
98+ htmlTable .append (INDENTATION +INDENTATION +"<tbody>\n " );
9499 for (final String name : keyWords ) {
95100 describe (name , factory , out );
96101 }
102+ htmlTable .append (INDENTATION +INDENTATION +"</tbody>\n " );
103+ out .println (htmlTable );
97104 }
98105
99106 private static String getVersionInfo () {
@@ -109,33 +116,53 @@ private static <T> void describe(final String name, final ObjectFactory<T> facto
109116 final ConfigurableClass <? extends T > configurableClass = factory .get (name );
110117 final Class <? extends T > moduleClass = configurableClass .getPlainClass ();
111118 final Description desc = moduleClass .getAnnotation (Description .class );
112-
119+ String indentation = INDENTATION + INDENTATION + INDENTATION ;
113120 out .println (name );
121+ htmlTable .append (indentation +"<tr>\n " );
122+ indentation =indentation +INDENTATION ;
123+ htmlTable .append (indentation +"<td>" +name +"</td>\n " );
124+
114125 name .chars ().forEach (c -> out .print ("-" ));
115126 out .println ();
116-
127+ htmlTable . append ( indentation + "<td>" );
117128 if (desc != null ) {
118129 out .println ("- description:\t " + desc .value ());
130+ htmlTable .append (desc .value ());
119131 }
120132 final Collection <String > arguments = getAvailableArguments (moduleClass );
121133 if (!arguments .isEmpty ()) {
122134 out .println ("- arguments:\t " + arguments );
135+ htmlTable .append ("\n Arguments: " +arguments );
123136 }
137+ htmlTable .append ("</td>\n " );
124138
139+ htmlTable .append (indentation );
125140 printAttributes (out , configurableClass , configurableClass .getSetters ());
141+ htmlTable .append (indentation );
126142 printSignature (out , moduleClass );
127143
128144 final String [] examplesEntry = EXAMPLES_MAP .get (name );
145+ htmlTable .append (indentation +"<td>" );
129146 if (examplesEntry != null && examplesEntry .length > 2 ) {
130147 out .println ("- [example in Playground]" + "(" + examplesEntry [2 ] + ")" );
148+ htmlTable .append ("<a href=\" " +examplesEntry [2 ]+"\" >example in Playground</a>" );
131149 }
132- if (examplesEntry != null && examplesEntry .length > 1 ) {
150+ htmlTable .append ("</td>\n " );
151+
152+ htmlTable .append (indentation +"<td>" );
153+ if (examplesEntry != null && examplesEntry .length > 1 ) {
133154 out .println ("- java class:\t [" + moduleClass .getCanonicalName () + "](" + examplesEntry [1 ] + ")" );
134- }
155+ htmlTable .append ("<a href=\" " +examplesEntry [1 ]+"\" >" + moduleClass .getCanonicalName ()+"</a>" );
156+ }
135157 else {
136158 out .println ("- java class:\t " + moduleClass .getCanonicalName ());
137- }
138- out .println ();
159+ htmlTable .append (moduleClass .getCanonicalName ());
160+
161+ }
162+ htmlTable .append ("</td>\n " );
163+
164+ out .println ();
165+ htmlTable .append (INDENTATION +INDENTATION +INDENTATION +"</tr>\n " );
139166 }
140167
141168 private static <T > void printSignature (final PrintStream out , final Class <? extends T > moduleClass ) {
@@ -150,10 +177,13 @@ private static <T> void printSignature(final PrintStream out, final Class<? exte
150177 outString = outClass .value ().getSimpleName ();
151178 }
152179 out .println ("- signature:\t " + inString + " -> " + outString );
180+ htmlTable .append ("<td>" +inString +"</td>\n " );
181+ htmlTable .append ("<td>" +outString +"</td>\n " );
153182 }
154183
155184 private static <T > void printAttributes (final PrintStream out , final ConfigurableClass <? extends T > configurableClass , final Map <String , Method > attributes ) {
156- if (!attributes .isEmpty ()) {
185+ String options ="" ;
186+ if (!attributes .isEmpty ()) {
157187 out .print ("- options:\t " );
158188 final StringBuilder builder = new StringBuilder ();
159189 for (final Entry <String , Method > entry : attributes .entrySet ()) {
@@ -178,8 +208,11 @@ private static <T> void printAttributes(final PrintStream out, final Configurabl
178208 }
179209
180210 }
181- out .println (builder .substring (0 , builder .length () - 2 ));
211+ options = builder .substring (0 , builder .length () - 2 );
212+ out .println (options );
182213 }
214+ htmlTable .append ("<td>" +options +"</td>\n " );
215+
183216 }
184217
185218 @ SuppressWarnings ("unchecked" )
0 commit comments