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


Java PageTitle.make方法代码示例

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


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

示例1: visit

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的package包/类
public void visit(WtInternalLink link) throws UnsupportedEncodingException {
    try {
        if (link.getTarget().isResolved()) {
            PageTitle page = PageTitle.make(config, link.getTarget().getAsString());
            if (page.getNamespace().equals(config.getNamespace("Category")))
                return;
        }
    } catch (LinkTargetException e) {
        // fall down
    }

    /*if (!link.hasTitle()) {
        iterate(link.getTarget());
    } else {
        String title = getContent(link.getTitle());
        String target = UriUtils.encode(getContent(link.getTarget()), "UTF-8");
        String url = config.getWikiUrl() + "/wiki/" + target;
        write(CommonUtils.mdLink(title, url));
    }*/

    iterate(link.hasTitle() ? link.getTitle() : link.getTarget());
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:23,代码来源:TextConverter.java

示例2: getCompiledPage

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的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

示例3: visit

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的package包/类
public void visit(InternalLink link)
{
	try
	{
		PageTitle page = PageTitle.make(config, link.getTarget());
		if (page.getNamespace().equals(config.getNamespace("Category"))) {
			return;
		}
	}
	catch (LinkTargetException e)
	{
	}

	write(link.getPrefix());
	if (link.getTitle().getContent() == null
	        || link.getTitle().getContent().isEmpty())
	{
		write(link.getTarget());
	}
	else
	{
		iterate(link.getTitle());
	}
	write(link.getPostfix());
}
 
开发者ID:dkpro,项目名称:dkpro-jwpl,代码行数:26,代码来源:PlainTextConverter.java

示例4: visit

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的package包/类
public void visit(InternalLink link)
{
	try
	{
		PageTitle page = PageTitle.make(config, link.getTarget());
		if (page.getNamespace().equals(config.getNamespace("Category"))) {
			return;
		}
	}
	catch (LinkTargetException e)
	{
	}

	if (link.getTitle().getContent() == null
	        || link.getTitle().getContent().isEmpty())
	{
		String anchor = link.getTarget();
		if(!anchor.contains(":")){
			add(link.getTarget());
		}
	}
	else
	{
		iterate(link.getTitle());
	}
}
 
开发者ID:fauconnier,项目名称:LaToe,代码行数:27,代码来源:InternalLinkAnchorExtractor.java

示例5: visit

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的package包/类
public void visit(ImageLink link) throws IOException {
  final PageTitle targetPageTitle;
  try {
    targetPageTitle = PageTitle.make(configuration, link.getTarget());
  } catch (LinkTargetException e) {
    throw new IOException(e);
  }
  String target =
      getPageNameForTitle(pageTitle.getDenormalizedTitle()) + "/" +
      targetPageTitle.getDenormalizedTitle() + "?attredirects=0";
  print("<img src=\"");
  print(target);
  if (!link.getTitle().getContent().isEmpty()) {
    print("\" title=\"");
    iterate(link.getTitle());
  }
  print("\" />");
  images.add(targetPageTitle.getDenormalizedTitle());
}
 
开发者ID:roubert,项目名称:mediawiki-googlesites,代码行数:20,代码来源:SiteImporterImpl.java

示例6: parse

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的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

示例7: parseText

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的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

示例8: visit

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的package包/类
public void visit(InternalLink link)
{
	try
	{
		PageTitle page = PageTitle.make(config, link.getTarget());
		if (page.getNamespace().equals(config.getNamespace("Category")))
			return;
	}
	catch (LinkTargetException e)
	{
	}

	write(link.getPrefix());
	if (link.getTitle().getContent() == null
			|| link.getTitle().getContent().isEmpty())
	{
		write(link.getTarget());
	}
	else
	{
		iterate(link.getTitle());
	}
	write(link.getPostfix());
}
 
开发者ID:agibsonccc,项目名称:solrsherlock-maven,代码行数:25,代码来源:TextConverter.java

示例9: visit

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的package包/类
public void visit(InternalLink link) {
  try {
    PageTitle page = PageTitle.make(config, link.getTarget());
    if (page.getNamespace().equals(config.getNamespace("Category")))
      return;
  } catch (LinkTargetException e) {
  }

  addMapping(link);
  write(link.getPrefix());

  if (link.getTitle().getContent() == null
          || link.getTitle().getContent().isEmpty()) {
    addMapping(link);
    write(link.getTarget());
  } else {
    addMapping(link);
    iterate(link.getTitle());
  }
  write(link.getPostfix());
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:22,代码来源:TextConverter.java

示例10: processedPage

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的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

示例11: getCompiledPage

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的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

示例12: visit

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的package包/类
public void visit(InternalLink link)
{
	try
	{
		PageTitle page = PageTitle.make(config, link.getTarget());
		if (page.getNamespace().equals(config.getNamespace("Category"))) {
			return;
		}else{
			String curLinkTitle="";
			for(AstNode n:link.getTitle().getContent()){
				if(n instanceof Text){
					curLinkTitle = ((Text)n).getContent().trim();
				}
			}
			if(curLinkTitle.isEmpty()){
				bodyBuilder.append(link.getTarget());
			}else{
				bodyBuilder.append(curLinkTitle);
			}

		}
	}
	catch (LinkTargetException e)
	{
	}

}
 
开发者ID:dkpro,项目名称:dkpro-jwpl,代码行数:28,代码来源:SectionExtractor.java

示例13: parsePage

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的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

示例14: visit

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的package包/类
public void visit(WtInternalLink link)
{
    try
    {
        if (link.getTarget().isResolved())
        {
            PageTitle page = PageTitle.make(config, link.getTarget().getAsString());
            if (page.getNamespace().equals(config.getNamespace("Category"))) {
                return;
            }
            else if(page.getNamespace().isFileNs() || page.getNamespace().isMediaNs()) {
                return;
            }
        }
    }
    catch (LinkTargetException e)
    {
    }

    //int start = sb.length();

    if(!isInsideFilteredSection()) {
        sb.append(link.getPrefix());
    }

    if (!link.hasTitle())
    {
        iterate(link.getTarget());
    }
    else
    {
        iterate(link.getTitle());
    }

    if(!isInsideFilteredSection()) {
        sb.append(link.getPostfix());
    }

    //int end = sb.length();
}
 
开发者ID:marcusklang,项目名称:wikiforia,代码行数:41,代码来源:SwebleTextAstWalker.java

示例15: SwebleWikipediaTextFilter

import org.sweble.wikitext.engine.PageTitle; //导入方法依赖的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


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