作者:手机用户2502927451 | 来源:互联网 | 2023-08-20 20:34
本文整理了Java中org.sweble.wikitext.engine.WtEngineImpl.()
方法的一些代码示例,展示了WtEngineImpl.()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WtEngineImpl.()
方法的具体详情如下:
包路径:org.sweble.wikitext.engine.WtEngineImpl
类名称:WtEngineImpl
方法名:
WtEngineImpl.介绍
暂无
代码示例
代码示例来源:origin: org.sweble.wikitext/swc-engine
public void restartEngine(WikiConfigImpl wikiConfig)
{
this.wikiCOnfig= wikiConfig;
this.engine = new WtEngineImpl(wikiConfig);
}
代码示例来源:origin: sweble/sweble-wikitext
public void restartEngine(WikiConfigImpl wikiConfig)
{
this.wikiCOnfig= wikiConfig;
this.engine = new WtEngineImpl(wikiConfig);
}
代码示例来源:origin: kermitt2/entity-fishing
/**
* Hidden constructor
*/
private MediaWikiParser() {
// set-up simple wiki configurations
cOnfigs= new HashMap();
// set-up language specific parsers
engines = new HashMap();
WikiConfig cOnfig= DefaultConfigEnWp.generate();
configs.put("en", config);
WtEngineImpl engine = new WtEngineImpl(config);
engines.put("en", engine);
cOnfig= DefaultConfigFrWp.generate();
configs.put("fr", config);
engine = new WtEngineImpl(config);
engines.put("fr", engine);
cOnfig= DefaultConfigDeWp.generate();
configs.put("de", config);
engine = new WtEngineImpl(config);
engines.put("de", engine);
cOnfig= DefaultConfigItWp.generate();
configs.put("it", config);
engine = new WtEngineImpl(config);
engines.put("it", engine);
cOnfig= DefaultConfigEsWp.generate();
configs.put("es", config);
engine = new WtEngineImpl(config);
engines.put("es", engine);
}
代码示例来源:origin: marcusklang/wikiforia
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);
}
}
代码示例来源:origin: sweble/sweble-wikitext
static String run(File file, String fileTitle, String query) throws LinkTargetException, IOException, EngineException
{
// Set-up a simple wiki configuration
WikiConfig cOnfig= DefaultConfigEnWp.generate();
// Instantiate a compiler for wiki pages
WtEngineImpl engine = new WtEngineImpl(config);
// Retrieve a page
PageTitle pageTitle = PageTitle.make(config, fileTitle);
PageId pageId = new PageId(pageTitle, -1);
String wikitext = FileUtils.readFileToString(file, Charset.defaultCharset().name());
// Compile the retrieved page
EngProcessedPage cp = engine.postprocess(pageId, wikitext, null);
return XPath.query(cp, query);
}
}
代码示例来源:origin: sweble/sweble-wikitext
static String run(File file, String fileTitle, boolean renderHtml) throws IOException, LinkTargetException, EngineException
{
// Set-up a simple wiki configuration
WikiConfig cOnfig= DefaultConfigEnWp.generate();
final int wrapCol = 80;
// Instantiate a compiler for wiki pages
WtEngineImpl engine = new WtEngineImpl(config);
// Retrieve a page
PageTitle pageTitle = PageTitle.make(config, fileTitle);
PageId pageId = new PageId(pageTitle, -1);
String wikitext = FileUtils.readFileToString(file, Charset.defaultCharset().name());
// Compile the retrieved page
EngProcessedPage cp = engine.postprocess(pageId, wikitext, null);
if (renderHtml)
{
String ourHtml = HtmlRenderer.print(new MyRendererCallback(), config, pageTitle, cp.getPage());
String template = IOUtils.toString(App.class.getResourceAsStream("/render-template.html"), "UTF8");
String html = template;
html = html.replace("{$TITLE}", StringTools.escHtml(pageTitle.getDenormalizedFullTitle()));
html = html.replace("{$CONTENT}", ourHtml);
return html;
}
else
{
TextConverter p = new TextConverter(config, wrapCol);
return (String) p.go(cp.getPage());
}
}
代码示例来源:origin: dkpro/dkpro-jwpl
/**
* Returns CompiledPage produced by the SWEBLE parser using the
* SimpleWikiConfiguration.
*
* @return the parsed page
* @throws LinkTargetException
* @throws EngineException if the wiki page could not be compiled by the parser
* @throws JAXBException
* @throws FileNotFoundException
*/
private static EngProcessedPage getCompiledPage(String text, String title, long revision) throws LinkTargetException, EngineException, FileNotFoundException, JAXBException
{
WikiConfig cOnfig= DefaultConfigEnWp.generate();
PageTitle pageTitle = PageTitle.make(config, title);
PageId pageId = new PageId(pageTitle, revision);
// Compile the retrieved page
WtEngineImpl engine = new WtEngineImpl(config);
// Compile the retrieved page
return engine.postprocess(pageId, text, null);
}
代码示例来源:origin: sweble/sweble-wikitext
WtEngineImpl engine = new WtEngineImpl(config);
代码示例来源:origin: dkpro/dkpro-jwpl
/**
* Returns CompiledPage produced by the SWEBLE parser using the SimpleWikiConfiguration.
*
* @return the parsed page
* @throws WikiApiException Thrown if errors occurred.
*/
private EngProcessedPage getCompiledPage() throws WikiApiException
{
EngProcessedPage cp;
try{
WtEngineImpl engine = new WtEngineImpl(this.wiki.getWikConfig());
PageTitle pageTitle = PageTitle.make(this.wiki.getWikConfig(), this.getTitle().toString());
PageId pageId = new PageId(pageTitle, -1);
// Compile the retrieved page
cp = engine.postprocess(pageId, this.getText(), null);
} catch(Exception e){
throw new WikiApiException(e);
}
return cp;
}
代码示例来源:origin: sweble/sweble-wikitext
WtEngineImpl engine = new WtEngineImpl(config);