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


Java PageId类代码示例

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


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

示例1: getCompiledPage

import org.sweble.wikitext.engine.PageId; //导入依赖的package包/类
/**
 * Returns CompiledPage produced by the SWEBLE parser using the
 * SimpleWikiConfiguration.
 *
 * @return the parsed page
 * @throws WikiApiException
 */
public CompiledPage getCompiledPage() throws WikiApiException
{
	CompiledPage cp;
	try{
		SimpleWikiConfiguration config = new SimpleWikiConfiguration(SWEBLE_CONFIG);

		PageTitle pageTitle = PageTitle.make(config, this.getTitle().toString());
		PageId pageId = new PageId(pageTitle, -1);

		// Compile the retrieved page
		Compiler compiler = new Compiler(config);
		cp = compiler.postprocess(pageId, this.getText(), null);
	}catch(Exception e){
		throw new WikiApiException(e);
	}
	return cp;
}
 
开发者ID:dkpro,项目名称:dkpro-jwpl,代码行数:25,代码来源:Page.java

示例2: parse

import org.sweble.wikitext.engine.PageId; //导入依赖的package包/类
public String parse(String markupText) {
    if (config == null || compiler == null) {
        init();
    }

    try {
        PageTitle pageTitle = PageTitle.make(config, "PageTitle");
        PageId pageId = new PageId(pageTitle, -1);
        CompiledPage cp = compiler.postprocess(pageId, markupText, null);
        StringWriter w = new StringWriter();
        HtmlPrinter p = new HtmlPrinter(w, pageTitle.getFullTitle());
        p.setStandaloneHtml(false, "");
        p.go(cp.getPage());
        return w.toString();
    } catch (Exception e) {
        return "<b>Failed to compile message:</b><br/>" + e.toString();
    }
}
 
开发者ID:masterhard,项目名称:rich-text-publisher-plugin,代码行数:19,代码来源:WikiTextMarkupParser.java

示例3: parseText

import org.sweble.wikitext.engine.PageId; //导入依赖的package包/类
/** Generate an Abstract Syntax Tree representation (AST) representation 
 *  of a given wikitext using the Sweble Parser 2.0.0-alpha-2-SNAPSHOT version,
 *  and eventually generates an XML representation using a visitor class.
 * 
 * @param wikitext
 * @param pagetitle
 * @return wikitext in XML
 * @throws JAXBException
 * @throws CompilerException
 * @throws LinkTargetException
 * @throws IOException
 */
public String parseText(String wikitext, String pagetitle, String language) 
		throws JAXBException, CompilerException, LinkTargetException, IOException {
			
	WikiConfig config = DefaultConfigEn.generate();

	// Instantiate Sweble parser
	WtEngine engine = new WtEngine(config);

	PageTitle pageTitle = PageTitle.make(config, pagetitle);		
	PageId pageId = new PageId(pageTitle, -1);
	// Parse Wikitext into AST
	EngCompiledPage cp = engine.postprocess(pageId, wikitext, null);		
	
	// Render AST to XML		
	String uri = language+".wikipedia.org/wiki/";
	String wikiXML = XMLRenderer.print(new MyRendererCallback(), config, pageTitle, cp.getPage(),uri);
	
	return wikiXML;
}
 
开发者ID:IDS-Mannheim,项目名称:Wikipedia-Corpus-Converter,代码行数:32,代码来源:Sweble2Parser.java

示例4: processedPage

import org.sweble.wikitext.engine.PageId; //导入依赖的package包/类
private EngProcessedPage processedPage(Article article) {
    try {
        PageTitle pageTitle = PageTitle.make(config, article.getTitle());
        PageId pageId = new PageId(pageTitle, Integer.parseInt(article.getRevisionId()));
        return engine.postprocess(pageId, article.getText(), null);
    } catch (LinkTargetException | EngineException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:10,代码来源:WikiFurService.java

示例5: getCompiledPage

import org.sweble.wikitext.engine.PageId; //导入依赖的package包/类
/**
 * Returns CompiledPage produced by the SWEBLE parser using the
 * SimpleWikiConfiguration.
 *
 * @return the parsed page
 * @throws LinkTargetException
 * @throws CompilerException if the wiki page could not be compiled by the parser
 * @throws JAXBException
 * @throws FileNotFoundException
 */
private static CompiledPage getCompiledPage(String text, String title, long revision) throws LinkTargetException, CompilerException, FileNotFoundException, JAXBException
{
	SimpleWikiConfiguration config = new SimpleWikiConfiguration(SWEBLE_CONFIG);

	PageTitle pageTitle = PageTitle.make(config, title);
	PageId pageId = new PageId(pageTitle, revision);
	// Compile the retrieved page
	Compiler compiler = new Compiler(config);
	return compiler.postprocess(pageId, text, null);
}
 
开发者ID:dkpro,项目名称:dkpro-jwpl,代码行数:21,代码来源:ParseUtils.java

示例6: parsePage

import org.sweble.wikitext.engine.PageId; //导入依赖的package包/类
public static EngProcessedPage parsePage(WikiConfig config, String title, long revision, String markup) throws EngineException, LinkTargetException {
    WtEngineImpl engine = new WtEngineImpl(config);

    PageTitle pageTitle = PageTitle.make(config, title);
    PageId pageId = new PageId(pageTitle, revision);

    return parseWikipage(engine, pageId, markup);
}
 
开发者ID:marcusklang,项目名称:wikiforia,代码行数:9,代码来源:SwebleParserUtil.java

示例7: SwebleWikipediaTextFilter

import org.sweble.wikitext.engine.PageId; //导入依赖的package包/类
public SwebleWikipediaTextFilter() {
  try {
    config = new SimpleWikiConfiguration(
            "classpath:/org/languagetool/resource/dev/SimpleWikiConfiguration.xml");
    compiler = new Compiler(config);
    PageTitle pageTitle = PageTitle.make(config, "fileTitle");
    pageId = new PageId(pageTitle, -1);
  } catch (Exception e) {
    throw new RuntimeException("Could not set up text filter", e);
  }
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:12,代码来源:SwebleWikipediaTextFilter.java

示例8: MathConverter

import org.sweble.wikitext.engine.PageId; //导入依赖的package包/类
public MathConverter(String wikiText, String name) throws LinkTargetException, EngineException {
    pageTitle = PageTitle.make(config, name);
    PageId pageId = new PageId(pageTitle, -1);
    page = engine.postprocess(pageId, wikiText, null);
    texInfoUrl = (new BaseConfig()).getTexvcinfoUrl();
}
 
开发者ID:ag-gipp,项目名称:mathosphere,代码行数:7,代码来源:MathConverter.java

示例9: parseWikipage

import org.sweble.wikitext.engine.PageId; //导入依赖的package包/类
public static EngProcessedPage parseWikipage(WtEngineImpl engine, PageId pageId, String markup) throws EngineException {
    return engine.postprocess(pageId, markup, null);
}
 
开发者ID:marcusklang,项目名称:wikiforia,代码行数:4,代码来源:SwebleParserUtil.java

示例10: parse

import org.sweble.wikitext.engine.PageId; //导入依赖的package包/类
String parse(String wikiOrigText, WikiIDTitlePair id_title, boolean csvOrReadable) throws CompilerException,
		LinkTargetException, EngineException {
	WikiConfig config = DefaultConfigEn.generate();

	WtEngineImpl engine = new WtEngineImpl(config);

	// Retrieve a page
	PageTitle pageTitle = PageTitle.make(config, id_title.getWikiTitle());

	PageId pageId = new PageId(pageTitle, -1);

	// Compile the retrieved page
	EngProcessedPage cp = engine.postprocess(pageId, wikiOrigText, null);

	TextConverter p = new TextConverter(config, wrapCol);
	p.setCsvOrReadable(csvOrReadable);

	return (String) p.go(cp.getPage());
}
 
开发者ID:hinneburg,项目名称:TopicExplorer,代码行数:20,代码来源:PreMalletParallelization.java


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