本文整理汇总了Java中org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder类的典型用法代码示例。如果您正苦于以下问题:Java HtmlDocumentBuilder类的具体用法?Java HtmlDocumentBuilder怎么用?Java HtmlDocumentBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HtmlDocumentBuilder类属于org.eclipse.mylyn.wikitext.core.parser.builder包,在下文中一共展示了HtmlDocumentBuilder类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parse
import org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder; //导入依赖的package包/类
static String parse(Path path) {
if (!path.toFile().exists()){
return "";
}
StringWriter sw = new StringWriter();
MarkupParser parser = new MarkupParser();
parser.setMarkupLanguage(new MarkdownLanguage());
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(sw);
builder.setEmitAsDocument(false);
parser.setBuilder(builder);
try {
parser.parse(new StringReader(new String(Files.readAllBytes(path))));
} catch (IOException e) {
e.printStackTrace();
}
return sw.toString();
}
开发者ID:Itema-as,项目名称:dawn-marketplace-server,代码行数:18,代码来源:PageController.java
示例2: toHtml
import org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder; //导入依赖的package包/类
static String toHtml(String markdown) {
if (markdown == null) {
return "";
}
StringWriter sw = new StringWriter();
MarkupParser parser = new MarkupParser();
parser.setMarkupLanguage(new MarkdownLanguage());
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(sw);
builder.setEmitAsDocument(false);
parser.setBuilder(builder);
try {
parser.parse(new StringReader(markdown));
} catch (IOException e) {
e.printStackTrace();
}
return sw.toString();
}
开发者ID:Itema-as,项目名称:dawn-marketplace-server,代码行数:18,代码来源:NodeProxy.java
示例3: toHtml
import org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder; //导入依赖的package包/类
private static String toHtml(String markdown) {
if (markdown == null) {
return "";
}
StringWriter sw = new StringWriter();
MarkupParser parser = new MarkupParser();
parser.setMarkupLanguage(new MarkdownLanguage());
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(sw);
builder.setEmitAsDocument(false);
parser.setBuilder(builder);
try {
parser.parse(new StringReader(markdown));
} catch (IOException e) {
e.printStackTrace();
}
return sw.toString();
}
开发者ID:Itema-as,项目名称:dawn-marketplace-server,代码行数:18,代码来源:SolutionEditor.java
示例4: loadMarkDown
import org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder; //导入依赖的package包/类
/**
* Загружает документ markdown из classpath
*
* @param resource путь к документу в classpath
* @return Подготовленный html документ
* @throws java.io.IOException if any.
*/
public static String loadMarkDown(final String resource) throws IOException {
// Читаем файл помоци
final InputStream contentStream = HelpContent.class.getResourceAsStream(resource);
final String content = CharStreams.toString(new InputStreamReader(contentStream, Charsets.UTF_8));
Closeables.close(contentStream, true);
// Читаем файл стилей
final InputStream cssStream = HelpContent.class.getResourceAsStream("/help/rest/help.css");
final String cssContent = CharStreams.toString(new InputStreamReader(cssStream, Charsets.UTF_8))
.replaceAll(System.getProperty("line.separator"), "");
Closeables.close(contentStream, true);
// Преобразуем в html
final StringBuilder out = new StringBuilder();
final HtmlDocumentBuilder builder = new HtmlDocumentBuilder(CharStreams.asWriter(out));
final HtmlDocumentBuilder.Stylesheet stylesheet = new HtmlDocumentBuilder.Stylesheet(new StringReader(cssContent));
builder.addCssStylesheet(stylesheet);
final MarkupParser markupParser = new MarkupParser();
markupParser.setMarkupLanguage(new TextileLanguage());
markupParser.setBuilder(builder);
markupParser.parse(content);
return out.toString();
}
开发者ID:ExtaSoft,项目名称:extacrm,代码行数:31,代码来源:HelpContent.java
示例5: execute
import org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder; //导入依赖的package包/类
public void execute( ExecutionContext executionContext ) throws ParsingException, ExecutionException
{
HtmlDocumentBuilder builder = new HtmlDocumentBuilder( executionContext.getWriter() );
MarkupParser markupParser = new MarkupParser( adapter.markupLanguage );
markupParser.setBuilder( builder );
markupParser.parse( sourceCode, false );
}
开发者ID:tliron,项目名称:scripturian,代码行数:8,代码来源:WikiTextProgram.java
示例6: printHelloWorld
import org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder; //导入依赖的package包/类
private static void printHelloWorld(MarkupLanguage markupLanguage, String languageName, String text) {
printHeader(languageName);
StringWriter writer = new StringWriter();
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer);
builder.setEmitAsDocument(false);
MarkupParser parser = new MarkupParser(markupLanguage, builder);
parser.parse(text);
System.out.println(writer.toString());
System.out.println();
}
开发者ID:jmini,项目名称:mylyn-wikitext-repository,代码行数:11,代码来源:WikitextMain.java
示例7: convert
import org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder; //导入依赖的package包/类
@Override
public String convert(String content) {
MarkupParser parser = getMarkupParser();
StringWriter writer = new StringWriter();
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer);
// avoid the <html> and <body> tags
builder.setEmitAsDocument(false);
parser.setBuilder(builder);
parser.parse(content);
parser.setBuilder(null);
return writer.toString();
}
开发者ID:opoo,项目名称:opoopress,代码行数:15,代码来源:AbstractWikiTextConverter.java
示例8: parse
import org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder; //导入依赖的package包/类
public String parse(String markupText) {
try {
StringWriter writer = new StringWriter();
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer);
builder.setEmitAsDocument(false);
org.eclipse.mylyn.wikitext.core.parser.MarkupParser parser = new org.eclipse.mylyn.wikitext.core.parser.MarkupParser(new ConfluenceLanguage());
parser.setBuilder(builder);
parser.parse(markupText);
return writer.toString();
} catch (Exception e) {
return "<b>Failed to compile message:</b><br/>" + e.toString();
}
}
开发者ID:masterhard,项目名称:rich-text-publisher-plugin,代码行数:14,代码来源:ConfluenceMarkupParser.java
注:本文中的org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论