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 String
OPTIONAL_LICENSE_TEXT_CLASS
static String
REPLACEABLE_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 void
beginOptional(LicenseTemplateRule rule)
Begin optional rule foundvoid
completeParsing()
Signals all text has been added and parsing can be completed.void
endOptional(LicenseTemplateRule rule)
End optional rule foundstatic String
escapeIdString(String id)
Escape the ID string to conform to the legal characters for an HTML ID stringstatic String
formatEndOptionalHTML(boolean inParagraph)
static String
formatReplaceabledHTML(String text, String id)
Deprecated.static String
formatReplaceableHTML(String text, String id)
Format HTML for a replaceable stringstatic String
formatStartOptionalHTML(String id)
Format HTML for an optional stringString
getHtml()
void
text(String text)
Text for processingvoid
variableRule(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:ILicenseTemplateOutputHandler
Text for processing- Specified by:
text
in interfaceILicenseTemplateOutputHandler
- Parameters:
text
- text to be processed
-
variableRule
public void variableRule(LicenseTemplateRule rule)
Description copied from interface:ILicenseTemplateOutputHandler
Variable rule found within the template- Specified by:
variableRule
in 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:ILicenseTemplateOutputHandler
Begin optional rule found- Specified by:
beginOptional
in 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:ILicenseTemplateOutputHandler
End optional rule found- Specified by:
endOptional
in interfaceILicenseTemplateOutputHandler
- Parameters:
rule
- end optional rule
-
completeParsing
public void completeParsing()
Description copied from interface:ILicenseTemplateOutputHandler
Signals all text has been added and parsing can be completed.- Specified by:
completeParsing
in interfaceILicenseTemplateOutputHandler
-
-