Package org.apache.wiki.htmltowiki
Class HtmlStringToWikiTranslator
- java.lang.Object
-
- org.apache.wiki.htmltowiki.HtmlStringToWikiTranslator
-
public class HtmlStringToWikiTranslator extends java.lang.Object
Converting Html to Wiki Markup with NekoHtml for converting html to xhtml and Xhtml2WikiTranslator for converting xhtml to Wiki Markup.
-
-
Constructor Summary
Constructors Constructor Description HtmlStringToWikiTranslator(Engine e)
Create a new translator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
element2String(org.jdom2.Element element)
A static helper method to create HTML from an Element.java.lang.String
translate(java.lang.String html)
Translates text from HTML into WikiMarkup without a WikiContext (meaning some things perhaps cannot be translated).java.lang.String
translate(java.lang.String html, Context wikiContext)
Translates text from HTML into WikiMarkup with a WikiContext.java.lang.String
translate(java.lang.String html, XHtmlToWikiConfig config)
Translates text from HTML into WikiMarkup using a specified configuration.
-
-
-
Constructor Detail
-
HtmlStringToWikiTranslator
public HtmlStringToWikiTranslator(Engine e)
Create a new translator.
-
-
Method Detail
-
translate
public java.lang.String translate(java.lang.String html) throws org.jdom2.JDOMException, java.io.IOException, java.lang.ReflectiveOperationException
Translates text from HTML into WikiMarkup without a WikiContext (meaning some things perhaps cannot be translated). Uses the default configuration.- Parameters:
html
- HTML text to translate- Returns:
- WikiMarkup
- Throws:
org.jdom2.JDOMException
- If parsing failsjava.io.IOException
- For other kinds of errors.java.lang.ReflectiveOperationException
-
translate
public java.lang.String translate(java.lang.String html, Context wikiContext) throws org.jdom2.JDOMException, java.io.IOException, java.lang.ReflectiveOperationException
Translates text from HTML into WikiMarkup with a WikiContext. The translation accuracy is better. Uses the default configuration.- Parameters:
html
- HTML text to translatewikiContext
- The WikiContext to use.- Returns:
- WikiMarkup
- Throws:
org.jdom2.JDOMException
- If parsing failsjava.io.IOException
- For other kinds of errors.java.lang.ReflectiveOperationException
-
translate
public java.lang.String translate(java.lang.String html, XHtmlToWikiConfig config) throws org.jdom2.JDOMException, java.io.IOException, java.lang.ReflectiveOperationException
Translates text from HTML into WikiMarkup using a specified configuration.- Parameters:
html
- HTML text to translateconfig
- The configuration to use.- Returns:
- WikiMarkup
- Throws:
org.jdom2.JDOMException
- If parsing failsjava.io.IOException
- For other kinds of errors.java.lang.ReflectiveOperationException
-
element2String
public static java.lang.String element2String(org.jdom2.Element element)
A static helper method to create HTML from an Element.- Parameters:
element
- The element to get HTML from.- Returns:
- HTML
-
-