当前位置: 首页>>代码示例>>Java>>正文


Java MarkupParser类代码示例

本文整理汇总了Java中org.eclipse.mylyn.wikitext.core.parser.MarkupParser的典型用法代码示例。如果您正苦于以下问题:Java MarkupParser类的具体用法?Java MarkupParser怎么用?Java MarkupParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MarkupParser类属于org.eclipse.mylyn.wikitext.core.parser包,在下文中一共展示了MarkupParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.eclipse.mylyn.wikitext.core.parser.MarkupParser; //导入依赖的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.MarkupParser; //导入依赖的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.MarkupParser; //导入依赖的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.MarkupParser; //导入依赖的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: getHtml

import org.eclipse.mylyn.wikitext.core.parser.MarkupParser; //导入依赖的package包/类
public String getHtml() {
	StringWriter writer = new StringWriter();

	BlogHtmlBuilder builder = new BlogHtmlBuilder(writer, entry, fileBasePath);

	MarkupParser parser = new MarkupParser(new TextileLanguage());
	parser.setBuilder(builder);
	String contents = entry.getContents();
	
	Pattern pattern = Pattern.compile("\\[\\[([^\\]]*?)\\]\\]");
	Matcher matcher = pattern.matcher(contents);
	
	StringBuffer sb = new StringBuffer();
	while (matcher.find()) {
		String title = matcher.group(1);
		matcher.appendReplacement(sb, "<a href=\"" + linkBasePath + "/" + title.replace(' ', '_') + "\">" + title + "</a>");
	}
	matcher.appendTail(sb);
	
	parser.parse(sb.toString());

	return writer.toString();
}
 
开发者ID:rla,项目名称:old-blog,代码行数:24,代码来源:BlogTextileToHtml.java

示例6: getHtmlFormatText

import org.eclipse.mylyn.wikitext.core.parser.MarkupParser; //导入依赖的package包/类
public static String getHtmlFormatText(String wikiFormatText, String language) {
    if (language == null || language.isEmpty()) {
        LOG.log(Level.FINE, "Wiki language name is empty"); //NOI18N
        return null;
    }
    MarkupLanguage markupLanguage;
    ClassLoader originalContextCL = null;
    try {
        originalContextCL = setupContextClassLoader();
        markupLanguage = ServiceLocator.getInstance().getMarkupLanguage(language);
    } catch (IllegalArgumentException ex) {
        // issue #258571
        String msg = ex.getMessage();
        if(msg.startsWith("Cannot load markup language")) { // NOI18N
            LOG.log(Level.INFO, null, ex);       
            markupLanguage = null;
        } else {
            throw ex;
        }
    } finally {
        restoreContextClassLoader(originalContextCL);
    }
    if (markupLanguage == null) {
        LOG.log(Level.FINE, "Markup language for name {0} not found",language); //NOI18N
        return null;
    }
    MarkupParser parser = new MarkupParser(markupLanguage);
    String dirtyHtml = parser.parseToHtml(wikiFormatText);
    return cleanHtmlTags(dirtyHtml);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:WikiUtils.java

示例7: execute

import org.eclipse.mylyn.wikitext.core.parser.MarkupParser; //导入依赖的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

示例8: printHelloWorld

import org.eclipse.mylyn.wikitext.core.parser.MarkupParser; //导入依赖的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

示例9: extractPlainText

import org.eclipse.mylyn.wikitext.core.parser.MarkupParser; //导入依赖的package包/类
public static String extractPlainText(String wikiMarkup) {
  MarkupParser parser = new MarkupParser();
  parser.setMarkupLanguage(new MediaWikiLanguage());
  PlaintextDocumentBuilder builder = new PlaintextDocumentBuilder();
  parser.setBuilder(builder);
  parser.parse(wikiMarkup);
  return builder.getResult();
}
 
开发者ID:ag-gipp,项目名称:mathosphere,代码行数:9,代码来源:WikiTextUtils.java

示例10: convert

import org.eclipse.mylyn.wikitext.core.parser.MarkupParser; //导入依赖的package包/类
public void convert(Reader reader, Writer writer) throws IOException {
    DocBookDocumentBuilder builder = new DocBookDocumentBuilder(writer);
    MarkupParser parser = new MarkupParser();
    parser.setMarkupLanguage(markupLanguage);
    parser.setBuilder(builder);
    parser.parse(reader);
    writer.flush();
}
 
开发者ID:hitakaken,项目名称:bigfoot-maven-plugins,代码行数:9,代码来源:ConfluenceConverter.java

示例11: convert

import org.eclipse.mylyn.wikitext.core.parser.MarkupParser; //导入依赖的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

示例12: getMarkupParser

import org.eclipse.mylyn.wikitext.core.parser.MarkupParser; //导入依赖的package包/类
@Override
protected MarkupParser getMarkupParser() {
    return parser;
}
 
开发者ID:opoo,项目名称:opoopress,代码行数:5,代码来源:WikiTextMediaWikiConverter.java

示例13: createMarkupParser

import org.eclipse.mylyn.wikitext.core.parser.MarkupParser; //导入依赖的package包/类
private MarkupParser createMarkupParser() {
    final MarkupParser markupParser = new MarkupParser();
    markupParser.setMarkupLanguage(createMarkupLanguage());

    return markupParser;
}
 
开发者ID:sebhoss,项目名称:doxia-module-wikitext,代码行数:7,代码来源:AbstractWikitextParser.java

示例14: parse

import org.eclipse.mylyn.wikitext.core.parser.MarkupParser; //导入依赖的package包/类
void parse(inputType inputFormat, Reader inputReader, outputType outputType, Writer outputWriter) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, IOException {
    DocumentBuilder builder = outputType.getBuilder(outputWriter);
    MarkupLanguage language = inputFormat.getMarkupLanguage();
    MarkupParser parser = new MarkupParser(language, builder);
    parser.parse(inputReader);
}
 
开发者ID:uli-heller,项目名称:uli-mini-tools,代码行数:7,代码来源:Main.java

示例15: getMarkupParser

import org.eclipse.mylyn.wikitext.core.parser.MarkupParser; //导入依赖的package包/类
/**
 * Return the MarkupParser instance.
 *
 * @return MarkupParser for this converter.
 */
protected abstract MarkupParser getMarkupParser();
 
开发者ID:opoo,项目名称:opoopress,代码行数:7,代码来源:AbstractWikiTextConverter.java


注:本文中的org.eclipse.mylyn.wikitext.core.parser.MarkupParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。