Class HtmlContentTransformer
- java.lang.Object
-
- org.eclipse.epsilon.picto.transformers.HtmlContentTransformer
-
- All Implemented Interfaces:
ViewContentTransformer
public class HtmlContentTransformer extends java.lang.Object implements ViewContentTransformer
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<HtmlElementTransformer>
htmlElementTransformers
protected XmlHelper
xmlHelper
-
Constructor Summary
Constructors Constructor Description HtmlContentTransformer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addZoom(org.w3c.dom.Document document)
boolean
canTransform(ViewContent content)
protected org.w3c.dom.Element
getElementByName(org.w3c.dom.Element parent, java.lang.String name)
protected org.w3c.dom.NodeList
getElements(org.w3c.dom.Document document, java.lang.String xpath)
java.lang.String
getLabel(ViewContent content)
protected static ExternalContentTransformation
invokePandoc(java.nio.file.Path document, java.lang.String outputExt, java.lang.Object... additionalArgs)
Converts the HTML to the desired format using Pandoc.static java.nio.file.Path
pandoc(java.lang.String html, java.lang.String outputExt, java.lang.Object... additionalArgs)
Converts the HTML to the desired format using Pandoc.static java.nio.file.Path
pandoc(java.nio.file.Path document, java.lang.String outputExt, java.lang.Object... additionalArgs)
Converts the HTML to the desired format using Pandoc.static java.lang.String
pandocRaw(java.lang.String html, java.lang.String outputExt, java.lang.Object... additionalArgs)
Converts the HTML to the desired format using Pandoc.ViewContent
transform(ViewContent content, PictoView pictoView)
static java.nio.file.Path
wkhtmltopdf(java.lang.String html)
Converts HTML to PDF using wkhtmltopdf.static java.nio.file.Path
wkhtmltopdf(java.nio.file.Path document)
Converts HTML to PDF using wkhtmltopdf.
-
-
-
Field Detail
-
htmlElementTransformers
protected java.util.List<HtmlElementTransformer> htmlElementTransformers
-
xmlHelper
protected XmlHelper xmlHelper
-
-
Method Detail
-
canTransform
public boolean canTransform(ViewContent content)
- Specified by:
canTransform
in interfaceViewContentTransformer
-
getLabel
public java.lang.String getLabel(ViewContent content)
- Specified by:
getLabel
in interfaceViewContentTransformer
-
transform
public ViewContent transform(ViewContent content, PictoView pictoView) throws java.lang.Exception
- Specified by:
transform
in interfaceViewContentTransformer
- Throws:
java.lang.Exception
-
addZoom
protected void addZoom(org.w3c.dom.Document document)
-
getElementByName
protected org.w3c.dom.Element getElementByName(org.w3c.dom.Element parent, java.lang.String name)
-
getElements
protected org.w3c.dom.NodeList getElements(org.w3c.dom.Document document, java.lang.String xpath) throws java.lang.Exception
- Throws:
java.lang.Exception
-
pandocRaw
public static java.lang.String pandocRaw(java.lang.String html, java.lang.String outputExt, java.lang.Object... additionalArgs) throws java.io.IOException
Converts the HTML to the desired format using Pandoc.- Parameters:
html
- The raw HTML text.outputExt
- The output file format.additionalArgs
- Other arguments to pass to Pandoc.- Returns:
- The raw output of the file as a String.
- Throws:
java.io.IOException
- If invoking Pandoc fails.
-
pandoc
public static java.nio.file.Path pandoc(java.lang.String html, java.lang.String outputExt, java.lang.Object... additionalArgs) throws java.io.IOException
Converts the HTML to the desired format using Pandoc.- Parameters:
html
- The raw HTML text.outputExt
- The output file format.additionalArgs
- Other arguments to pass to Pandoc.- Returns:
- The output file.
- Throws:
java.io.IOException
- If invoking Pandoc fails.
-
pandoc
public static java.nio.file.Path pandoc(java.nio.file.Path document, java.lang.String outputExt, java.lang.Object... additionalArgs) throws java.io.IOException
Converts the HTML to the desired format using Pandoc.- Parameters:
document
- The HTML file.outputExt
- The output file format.additionalArgs
- Other arguments to pass to Pandoc.- Returns:
- The output file.
- Throws:
java.io.IOException
- If invoking Pandoc fails.
-
invokePandoc
protected static ExternalContentTransformation invokePandoc(java.nio.file.Path document, java.lang.String outputExt, java.lang.Object... additionalArgs) throws java.io.IOException
Converts the HTML to the desired format using Pandoc.- Parameters:
html
- The HTML file.outputExt
- The output file format.additionalArgs
- Other arguments to pass to Pandoc.- Returns:
- The transformation, prior to running it.
- Throws:
java.io.IOException
- If invoking Pandoc fails.
-
wkhtmltopdf
public static java.nio.file.Path wkhtmltopdf(java.lang.String html) throws java.io.IOException
Converts HTML to PDF using wkhtmltopdf.- Parameters:
html
- The raw HTML text.- Returns:
- The output PDF file.
- Throws:
java.io.IOException
- If invoking wkhtmltopdf fails.
-
wkhtmltopdf
public static java.nio.file.Path wkhtmltopdf(java.nio.file.Path document) throws java.io.IOException
Converts HTML to PDF using wkhtmltopdf.- Parameters:
html
- The HTML file.- Returns:
- The output PDF file.
- Throws:
java.io.IOException
- If invoking wkhtmltopdf fails.
-
-