Package org.jbake.parser
Class MarkupEngine
- java.lang.Object
-
- org.jbake.parser.MarkupEngine
-
- All Implemented Interfaces:
ParserEngine
- Direct Known Subclasses:
AsciidoctorEngine,ErrorEngine,MarkdownEngine,RawMarkupEngine,YamlEngine
public abstract class MarkupEngine extends java.lang.Object implements ParserEngine
Base class for markup engine wrappers. A markup engine is responsible for rendering markup in a source file and exporting the result into thecontentsmap.This specific engine does nothing, meaning that the body is rendered as raw contents.
-
-
Constructor Summary
Constructors Constructor Description MarkupEngine()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.Object>parse(org.apache.commons.configuration2.Configuration config, java.io.File file, java.lang.String contentPath)DocumentModelparse(JBakeConfiguration config, java.io.File file)Parse given file to extract as much infos as possiblevoidprocessBody(ParserContext context)Processes the body of the document.voidprocessHeader(ParserContext context)Processes the document header.booleanvalidate(ParserContext context)Tests if this markup engine can process the document.
-
-
-
Method Detail
-
validate
public boolean validate(ParserContext context)
Tests if this markup engine can process the document.- Parameters:
context- the parser context- Returns:
- true if this markup engine has enough context to process this document. false otherwise
-
processHeader
public void processHeader(ParserContext context)
Processes the document header. Usually subclasses will parse the document body and look for specific header metadata and export it intocontentsmap.- Parameters:
context- the parser context
-
processBody
public void processBody(ParserContext context)
Processes the body of the document. Usually subclasses will parse the document body and render it, exporting the result using theParserContext.setBody(String)method.- Parameters:
context- the parser context
-
parse
public java.util.Map<java.lang.String,java.lang.Object> parse(org.apache.commons.configuration2.Configuration config, java.io.File file, java.lang.String contentPath)- Specified by:
parsein interfaceParserEngine- Parameters:
config- The project configurationfile- The file to be parsedcontentPath- unknown- Returns:
- A model representation of the given file
-
parse
public DocumentModel parse(JBakeConfiguration config, java.io.File file)
Parse given file to extract as much infos as possible- Specified by:
parsein interfaceParserEngine- Parameters:
file- file to processconfig- The project configuration- Returns:
- a map containing all infos. Returning null indicates an error, even if an exception would be better.
-
-