本文整理汇总了Java中org.sweble.wikitext.engine.Compiler类的典型用法代码示例。如果您正苦于以下问题:Java Compiler类的具体用法?Java Compiler怎么用?Java Compiler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Compiler类属于org.sweble.wikitext.engine包,在下文中一共展示了Compiler类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCompiledPage
import org.sweble.wikitext.engine.Compiler; //导入依赖的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;
}
示例2: DumpWriterImpl
import org.sweble.wikitext.engine.Compiler; //导入依赖的package包/类
DumpWriterImpl(
ProgressListener progressListener,
WikiConfigurationInterface configuration,
File imagesDirectory,
PageImporter pageImporter,
URL feedUrl,
URL siteUrl,
SitesService sitesService) {
this.progressListener = progressListener;
this.configuration = configuration;
this.imagesDirectory = imagesDirectory;
this.pageImporter = pageImporter;
this.feedUrl = feedUrl;
this.siteUrl = siteUrl;
this.sitesService = sitesService;
compiler = new Compiler(configuration);
}
示例3: getCompiledPage
import org.sweble.wikitext.engine.Compiler; //导入依赖的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);
}
示例4: parse
import org.sweble.wikitext.engine.Compiler; //导入依赖的package包/类
public static WikiPageFeatures parse(String title, String wikiText) throws FileNotFoundException, JAXBException, LinkTargetException, CompilerException {
WikiConfigurationInterface configuration = threadLocalConfig.get();
if ( configuration == null ) {
throw new IllegalStateException("Cannot parse wikitext. WikiConfiguration not loaded.");
}
Compiler compiler = new Compiler(configuration);
PageTitle pageTitle = PageTitle.make(configuration, title);
PageId pageId = new PageId(pageTitle, -1);
CompiledPage cp = compiler.postprocess(pageId, wikiText, null);
WikitextReaderVisitor p = new WikitextReaderVisitor(title);
p.go(cp.getPage());
return p.getStructure();
}
示例5: SwebleWikipediaTextFilter
import org.sweble.wikitext.engine.Compiler; //导入依赖的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);
}
}