Package org.spdx.licenseTemplate
Class HtmlTemplateOutputHandler
- java.lang.Object
-
- org.spdx.licenseTemplate.HtmlTemplateOutputHandler
-
- All Implemented Interfaces:
ILicenseTemplateOutputHandler
public class HtmlTemplateOutputHandler extends Object implements ILicenseTemplateOutputHandler
License template output handler for generating an HTML version of a license from a license template. Used when parsing a license template.- Author:
- Gary O'Neall
-
-
Field Summary
Fields Modifier and Type Field Description static StringOPTIONAL_LICENSE_TEXT_CLASSstatic StringREPLACEABLE_LICENSE_TEXT_CLASS
-
Constructor Summary
Constructors Constructor Description HtmlTemplateOutputHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidbeginOptional(LicenseTemplateRule rule)Begin optional rule foundvoidcompleteParsing()Signals all text has been added and parsing can be completed.voidendOptional(LicenseTemplateRule rule)End optional rule foundstatic StringescapeIdString(String id)Escape the ID string to conform to the legal characters for an HTML ID stringstatic StringformatEndOptionalHTML(boolean inParagraph)static StringformatReplaceabledHTML(String text, String id)Deprecated.static StringformatReplaceableHTML(String text, String id)Format HTML for a replaceable stringstatic StringformatStartOptionalHTML(String id)Format HTML for an optional stringStringgetHtml()voidtext(String text)Text for processingvoidvariableRule(LicenseTemplateRule rule)Variable rule found within the template
-
-
-
Field Detail
-
REPLACEABLE_LICENSE_TEXT_CLASS
public static final String REPLACEABLE_LICENSE_TEXT_CLASS
- See Also:
- Constant Field Values
-
OPTIONAL_LICENSE_TEXT_CLASS
public static final String OPTIONAL_LICENSE_TEXT_CLASS
- See Also:
- Constant Field Values
-
-
Method Detail
-
text
public void text(String text)
Description copied from interface:ILicenseTemplateOutputHandlerText for processing- Specified by:
textin interfaceILicenseTemplateOutputHandler- Parameters:
text- text to be processed
-
variableRule
public void variableRule(LicenseTemplateRule rule)
Description copied from interface:ILicenseTemplateOutputHandlerVariable rule found within the template- Specified by:
variableRulein interfaceILicenseTemplateOutputHandler- Parameters:
rule- license template rule
-
formatReplaceableHTML
public static String formatReplaceableHTML(String text, String id)
Format HTML for a replaceable string- Parameters:
text- text for the optional license stringid- ID used for the div- Returns:
- a replaceable string
-
formatReplaceabledHTML
@Deprecated public static String formatReplaceabledHTML(String text, String id)
Deprecated.Format HTML for a replaceable string- Parameters:
text- text for the optional license stringid- ID used for the div- Returns:
- a replaceable string
-
escapeIdString
public static String escapeIdString(String id)
Escape the ID string to conform to the legal characters for an HTML ID string- Parameters:
id- an SPDX ID string- Returns:
- the id escaped for HTML
-
getHtml
public String getHtml()
- Returns:
- HTML result
-
beginOptional
public void beginOptional(LicenseTemplateRule rule)
Description copied from interface:ILicenseTemplateOutputHandlerBegin optional rule found- Specified by:
beginOptionalin interfaceILicenseTemplateOutputHandler- Parameters:
rule- optional rule
-
formatStartOptionalHTML
public static String formatStartOptionalHTML(String id)
Format HTML for an optional string- Parameters:
id- ID used for the div- Returns:
- a formated id for use in the div
-
formatEndOptionalHTML
public static String formatEndOptionalHTML(boolean inParagraph)
- Parameters:
inParagraph- true if in a paragraph- Returns:
- a string for formatting the end of an Optional HTML element
-
endOptional
public void endOptional(LicenseTemplateRule rule)
Description copied from interface:ILicenseTemplateOutputHandlerEnd optional rule found- Specified by:
endOptionalin interfaceILicenseTemplateOutputHandler- Parameters:
rule- end optional rule
-
completeParsing
public void completeParsing()
Description copied from interface:ILicenseTemplateOutputHandlerSignals all text has been added and parsing can be completed.- Specified by:
completeParsingin interfaceILicenseTemplateOutputHandler
-
-