Class XdocsTemplateParser
java.lang.Object
org.apache.maven.doxia.parser.AbstractParser
org.apache.maven.doxia.parser.AbstractXmlParser
org.apache.maven.doxia.parser.XhtmlBaseParser
org.apache.maven.doxia.module.xdoc.XdocParser
com.puppycrawl.tools.checkstyle.site.XdocsTemplateParser
- All Implemented Interfaces:
org.apache.maven.doxia.logging.LogEnabled,org.apache.maven.doxia.markup.HtmlMarkup,org.apache.maven.doxia.markup.Markup,org.apache.maven.doxia.markup.XmlMarkup,org.apache.maven.doxia.module.xdoc.XdocMarkup,org.apache.maven.doxia.parser.Parser
@Component(role=org.apache.maven.doxia.parser.Parser.class,
hint="xdocs-template")
public class XdocsTemplateParser
extends org.apache.maven.doxia.module.xdoc.XdocParser
Parser for Checkstyle's xdoc templates.
This parser is responsible for generating xdocs(
.xml) from the xdoc
templates(.xml.template). The templates are regular xdocs with custom
macros for generating dynamic content - properties, examples, etc.
This parser behaves just like the XdocParser with the difference that all
elements apart from the macro element are copied as is to the output.
This module will be removed once
#13426 is resolved.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.maven.doxia.parser.AbstractXmlParser
org.apache.maven.doxia.parser.AbstractXmlParser.CachedFileEntityResolver -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringA macro name.The macro parameters.private StringThe source content of the input reader.static final StringUser working directory.Fields inherited from interface org.apache.maven.doxia.markup.HtmlMarkup
A, ABBR, ACRONYM, ADDRESS, APPLET, AREA, ARTICLE, ASIDE, AUDIO, B, BASE, BASEFONT, BDI, BDO, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CANVAS, CAPTION, CDATA_TYPE, CENTER, CITE, CODE, COL, COLGROUP, COMMAND, DATA, DATALIST, DD, DEL, DETAILS, DFN, DIALOG, DIR, DIV, DL, DT, EM, EMBED, ENTITY_TYPE, FIELDSET, FIGCAPTION, FIGURE, FONT, FOOTER, FORM, FRAME, FRAMESET, H1, H2, H3, H4, H5, H6, HEAD, HEADER, HGROUP, HR, HTML, I, IFRAME, IMG, INPUT, INS, ISINDEX, KBD, KEYGEN, LABEL, LEGEND, LI, LINK, MAIN, MAP, MARK, MENU, META, METER, NAV, NOFRAMES, NOSCRIPT, OBJECT, OL, OPTGROUP, OPTION, OUTPUT, P, PARAM, PICTURE, PRE, PROGRESS, Q, RB, RP, RT, RTC, RUBY, S, SAMP, SCRIPT, SECTION, SELECT, SMALL, SOURCE, SPAN, STRIKE, STRONG, STYLE, SUB, SUMMARY, SUP, TABLE, TAG_TYPE_END, TAG_TYPE_SIMPLE, TAG_TYPE_START, TBODY, TD, TEMPLATE, TEXTAREA, TFOOT, TH, THEAD, TIME, TITLE, TR, TRACK, TT, U, UL, VAR, VIDEO, WBRFields inherited from interface org.apache.maven.doxia.markup.Markup
COLON, EOL, EQUAL, GREATER_THAN, LEFT_CURLY_BRACKET, LEFT_SQUARE_BRACKET, LESS_THAN, MINUS, PLUS, QUOTE, RIGHT_CURLY_BRACKET, RIGHT_SQUARE_BRACKET, SEMICOLON, SLASH, SPACE, STARFields inherited from interface org.apache.maven.doxia.parser.Parser
ROLE, TXT_TYPE, UNKNOWN_TYPE, XML_TYPEFields inherited from interface org.apache.maven.doxia.module.xdoc.XdocMarkup
AUTHOR_TAG, DATE_TAG, DOCUMENT_TAG, MACRO_TAG, PROPERTIES_TAG, SECTION_TAG, SOURCE_TAG, SUBSECTION_TAG, XDOC_NAMESPACE, XDOC_SYSTEM_IDFields inherited from interface org.apache.maven.doxia.markup.XmlMarkup
BANG, CDATA, DOCTYPE_START, ENTITY_START, XML_NAMESPACE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidhandleEndTag(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, org.apache.maven.doxia.sink.Sink sink) protected voidhandleStartTag(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, org.apache.maven.doxia.sink.Sink sink) voidprivate voidprocessMacroEnd(org.apache.maven.doxia.sink.Sink sink) Execute a macro.private voidprocessMacroStart(org.codehaus.plexus.util.xml.pull.XmlPullParser parser) Handle the opening tag of a macro.private voidprocessParamStart(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, org.apache.maven.doxia.sink.Sink sink) Handle the opening tag of a parameter.private voidReinitialize the macro fields.Methods inherited from class org.apache.maven.doxia.module.xdoc.XdocParser
consecutiveSections, initMethods inherited from class org.apache.maven.doxia.parser.XhtmlBaseParser
baseEndTag, baseStartTag, getSectionLevel, handleCdsect, handleComment, handleText, initXmlParser, isScriptBlock, isVerbatim, setSectionLevel, validAnchor, verbatim, verbatim_Methods inherited from class org.apache.maven.doxia.parser.AbstractXmlParser
getAddDefaultEntities, getAttributesFromParser, getLocalEntities, getText, getType, handleEntity, handleUnknown, isCollapsibleWhitespace, isIgnorableWhitespace, isTrimmableWhitespace, isValidate, setAddDefaultEntities, setCollapsibleWhitespace, setIgnorableWhitespace, setTrimmableWhitespace, setValidateMethods inherited from class org.apache.maven.doxia.parser.AbstractParser
doxiaVersion, enableLogging, executeMacro, getBasedir, getLog, getMacroManager, isEmitComments, isSecondParsing, parse, parse, parse, setEmitComments, setSecondParsing
-
Field Details
-
TEMP_DIR
User working directory. -
macroParameters
The macro parameters. -
sourceContent
The source content of the input reader. Used to pass into macros. -
macroName
A macro name.
-
-
Constructor Details
-
XdocsTemplateParser
public XdocsTemplateParser()
-
-
Method Details
-
parse
public void parse(Reader source, org.apache.maven.doxia.sink.Sink sink, String reference) throws org.apache.maven.doxia.parser.ParseException - Specified by:
parsein interfaceorg.apache.maven.doxia.parser.Parser- Overrides:
parsein classorg.apache.maven.doxia.module.xdoc.XdocParser- Throws:
org.apache.maven.doxia.parser.ParseException
-
handleStartTag
protected void handleStartTag(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, org.apache.maven.doxia.sink.Sink sink) throws org.apache.maven.doxia.macro.MacroExecutionException - Overrides:
handleStartTagin classorg.apache.maven.doxia.module.xdoc.XdocParser- Throws:
org.apache.maven.doxia.macro.MacroExecutionException
-
handleEndTag
protected void handleEndTag(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, org.apache.maven.doxia.sink.Sink sink) throws org.apache.maven.doxia.macro.MacroExecutionException - Overrides:
handleEndTagin classorg.apache.maven.doxia.module.xdoc.XdocParser- Throws:
org.apache.maven.doxia.macro.MacroExecutionException
-
processMacroStart
private void processMacroStart(org.codehaus.plexus.util.xml.pull.XmlPullParser parser) throws org.apache.maven.doxia.macro.MacroExecutionException Handle the opening tag of a macro. Gather the macro name and parameters.- Parameters:
parser- the xml parser.- Throws:
org.apache.maven.doxia.macro.MacroExecutionException- if the macro name is not specified.
-
processParamStart
private void processParamStart(org.codehaus.plexus.util.xml.pull.XmlPullParser parser, org.apache.maven.doxia.sink.Sink sink) throws org.apache.maven.doxia.macro.MacroExecutionException Handle the opening tag of a parameter. Gather the parameter name and value.- Parameters:
parser- the xml parser.sink- the sink object.- Throws:
org.apache.maven.doxia.macro.MacroExecutionException- if the parameter name or value is not specified.
-
processMacroEnd
private void processMacroEnd(org.apache.maven.doxia.sink.Sink sink) throws org.apache.maven.doxia.macro.MacroExecutionException Execute a macro. Creates aMacroRequestwith the gatheredmacroNameandmacroParametersand executes the macro. Afterward, the macro fields are reinitialized.- Parameters:
sink- the sink object.- Throws:
org.apache.maven.doxia.macro.MacroExecutionException- if a macro is not found.
-
reinitializeMacroFields
Reinitialize the macro fields.
-