public String optionToHtml ( Options . OptionInfo oi , int padding ) { StringBuilder b = new StringBuilder ( ) ; Formatter f = new Formatter ( b ) ; if ( oi . shortName != null ) { f . format ( "<b>-%s</b> " , oi . shortName ) ; } for ( String a : oi . aliases ) { f . format ( "<b>%s</b> " , a ) ; } String prefix = getUseSingleDash ( ) ? "-" : "--" ; f . format ( "<b>%s%s=</b><i>%s</i>" , prefix , oi . longName , oi . typeName ) ; if ( oi . list != null ) { b . append ( " <code>[+]</code>" ) ; } f . format ( ".%n " ) ; f . format ( "%s" , StringUtils . repeat ( " " , padding ) ) ; String jdoc = ( ( oi . jdoc == null ) ? "" : oi . jdoc ) ; if ( oi . noDocDefault || oi . defaultStr == null ) { f . format ( "%s" , jdoc ) ; } else { String defaultStr = "default " + oi . defaultStr ; // The default string must be HTML-escaped since it comes from a string // rather than a Javadoc comment. String suffix = "" ; if ( jdoc . endsWith ( "</p>" ) ) { suffix = "</p>" ; jdoc = jdoc . substring ( 0 , jdoc . length ( ) - suffix . length ( ) ) ; } f . format ( "%s [%s]%s" , jdoc , StringEscapeUtils . escapeHtml4 ( defaultStr ) , suffix ) ; } if ( oi . baseType . isEnum ( ) ) { b . append ( lineSep ) . append ( "<ul>" ) . append ( lineSep ) ; assert oi . enumJdoc != null : "@AssumeAssertion(nullness): dependent: non-null if oi.baseType is an enum" ; for ( Map . Entry < String , String > entry : oi . enumJdoc . entrySet ( ) ) { b . append ( " <li><b>" ) . append ( entry . getKey ( ) ) . append ( "</b>" ) ; if ( entry . getValue ( ) . length ( ) != 0 ) { b . append ( " " ) . append ( entry . getValue ( ) ) ; } // b.append("</li>"); b . append ( lineSep ) ; } b . append ( "</ul>" ) . append ( lineSep ) ; } return b . toString ( ) ; }
Get the line of HTML describing one Option .