• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LinkTargetException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: visit

import org.sweble.wikitext.lazy.LinkTargetException; //导入依赖的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


示例2: visit

import org.sweble.wikitext.lazy.LinkTargetException; //导入依赖的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


示例3: visit

import org.sweble.wikitext.lazy.LinkTargetException; //导入依赖的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


示例4: visit

import org.sweble.wikitext.lazy.LinkTargetException; //导入依赖的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


示例5: visit

import org.sweble.wikitext.lazy.LinkTargetException; //导入依赖的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


示例6: getCompiledPage

import org.sweble.wikitext.lazy.LinkTargetException; //导入依赖的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


示例7: visit

import org.sweble.wikitext.lazy.LinkTargetException; //导入依赖的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


示例8: parse

import org.sweble.wikitext.lazy.LinkTargetException; //导入依赖的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();
}
 
开发者ID:ArturD,项目名称:holmes,代码行数:15,代码来源:WikiTextFeaturesHelper.java


示例9: doFilter

import org.sweble.wikitext.lazy.LinkTargetException; //导入依赖的package包/类
@Override
protected WikiPageFeatures doFilter(PageInfo params) {
    try {
        return WikiTextFeaturesHelper.parse(params);
    } catch (FileNotFoundException | JAXBException | LinkTargetException | CompilerException e) {
        logger.warn("Cannot parse wikipage.", e);
        return null; // throw !!
    }
}
 
开发者ID:ArturD,项目名称:holmes,代码行数:10,代码来源:PageToFeaturesFilter.java


示例10: getSections

import org.sweble.wikitext.lazy.LinkTargetException; //导入依赖的package包/类
/**
 * Extracts sections (without title) from Wikitext.
 *
 * @param text article text with wiki markup
 * @param title article title
 * @param revision the revision id
 * @return list of ExtractedSections
 * @throws CompilerException if the wiki page could not be compiled by the parser
 */
public static List<ExtractedSection> getSections(String text, String title, long revision) throws LinkTargetException, CompilerException, FileNotFoundException, JAXBException{
	return (List<ExtractedSection>) parsePage(new SectionExtractor(), text, title, revision);
}
 
开发者ID:dkpro,项目名称:dkpro-jwpl,代码行数:13,代码来源:ParseUtils.java


示例11: getTemplateNames

import org.sweble.wikitext.lazy.LinkTargetException; //导入依赖的package包/类
/**
 * Extracts template names from Wikitext by descending into every node and looking for templates.
 * Results may contain duplicates if template appears multiple times in the article.
 *
 * @param text article text with wiki markup
 * @param title article title
 * @return list of template names
 * @throws CompilerException if the wiki page could not be compiled by the parser
 */
public static List<String> getTemplateNames(String text, String title) throws LinkTargetException, CompilerException, FileNotFoundException, JAXBException{
	return (List<String>) parsePage(new TemplateNameExtractor(), text, title, -1);
}
 
开发者ID:dkpro,项目名称:dkpro-jwpl,代码行数:13,代码来源:ParseUtils.java


示例12: parsePage

import org.sweble.wikitext.lazy.LinkTargetException; //导入依赖的package包/类
/**
 * Parses the page with the Sweble parser using a SimpleWikiConfiguration
 * and the provided visitor.
 *
 * @return the parsed page. The actual return type depends on the provided
 *         visitor. You have to cast the return type according to the return
 *         type of the go() method of your visitor.
 * @throws CompilerException if the wiki page could not be compiled by the parser
 */
private static Object parsePage(AstVisitor v, String text, String title, long revision) throws LinkTargetException, CompilerException, FileNotFoundException, JAXBException{
	// Use the provided visitor to parse the page
	return v.go(getCompiledPage(text, title, revision).getPage());
}
 
开发者ID:dkpro,项目名称:dkpro-jwpl,代码行数:14,代码来源:ParseUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EnvelopeStyle类代码示例发布时间:2022-05-23
下一篇:
Java Internal类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap