info.bliki.wiki.model.WikiModel.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中info.bliki.wiki.model.WikiModel.<init>()方法的一些代码示例,展示了WikiModel.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WikiModel.<init>()方法的具体详情如下:
包路径:info.bliki.wiki.model.WikiModel
类名称:WikiModel
方法名:<init>

WikiModel.<init>介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public String getHTMLFormat() {
  WikiModel wikiModel = new WikiModel(
      "http://en.wikipedia.org/wiki/${image}", "http://en.wikipedia.org/wiki/${title}");
  String htmlText = wikiModel.render(text);
  return htmlText;
}

代码示例来源:origin: edu.umd/cloud9

/**
 * Creates an empty <code>WikipediaPage</code> object.
 */
public WikipediaPage() {
 wikiModel = new WikiModel("", "");
 textConverter = new PlainTextConverter();
}

代码示例来源:origin: info.bliki.wiki/bliki-core

/**
 * Convert a given text in wiki notation into HTML text.
 *
 * @param rawWikiText
 *            a raw wiki text
 * @return the resulting HTML text; nay returns <code>null</code>, if an
 *         <code>IOException</code> occured.
 */
public static String toHtml(String rawWikiText) {
  try {
    StringBuilder resultBuffer = new StringBuilder(rawWikiText.length()
        + rawWikiText.length() / 10);
    toText(new WikiModel("/${image}", "/${title}"),
        new HTMLConverter(), rawWikiText, resultBuffer, false,
        false);
    return resultBuffer.toString();
  } catch (IOException ignored) {
  }
  return null;
}

代码示例来源:origin: info.bliki.wiki/bliki-core

/**
 * Convert a given text in wiki notation into HTML text.
 *
 * @param rawWikiText
 *            a raw wiki text
 * @param resultBuffer
 *            the buffer to which to append the resulting HTML code.
 * @throws IOException
 */
public static void toHtml(String rawWikiText, Appendable resultBuffer)
    throws IOException {
  toText(new WikiModel("/${image}", "/${title}"), new HTMLConverter(),
      rawWikiText, resultBuffer, false, false);
}

代码示例来源:origin: Stratio/morphlines

@Override
  protected boolean doProcess(Record record) {
    Object value = record.get(inputFieldName).get(0);
    WikiModel wikiModel = new WikiModel(
        "http://www.mywiki.com/wiki/${image}",
        "http://www.mywiki.com/wiki/${title}");
    String cleanText = wikiModel.render(new PlainTextConverter(),
        value.toString());
    Pattern p = Pattern.compile(TEMPLATE_PATTERN);
    Matcher m = p.matcher(cleanText);
    while (m.find()) {
      cleanText = m.replaceAll("");
      m = p.matcher(cleanText);
    }
    record.put(outputFieldName, cleanText.trim());
    // pass record to next command in chain:
    return super.doProcess(record);
  }
}

代码示例来源:origin: com.stratio.morphlines/wikipediacleaner

@Override
  protected boolean doProcess(Record record) {
    Object value = record.get(inputFieldName).get(0);
    WikiModel wikiModel = new WikiModel(
        "http://www.mywiki.com/wiki/${image}",
        "http://www.mywiki.com/wiki/${title}");
    String cleanText = wikiModel.render(new PlainTextConverter(),
        value.toString());
    Pattern p = Pattern.compile(TEMPLATE_PATTERN);
    Matcher m = p.matcher(cleanText);
    while (m.find()) {
      cleanText = m.replaceAll("");
      m = p.matcher(cleanText);
    }
    record.put(outputFieldName, cleanText.trim());
    // pass record to next command in chain:
    return super.doProcess(record);
  }
}

代码示例来源:origin: edu.illinois.cs.cogcomp/wikipediaAPI

WikiModel wikiModel = new WikiModel("${image}", "${title}"); // do not

代码示例来源:origin: edu.illinois.cs.cogcomp/wikipediaAPI-multilingual

WikiModel wikiModel = new WikiModel("${image}", "${title}"); // do not

代码示例来源:origin: info.bliki.wiki/bliki-core

char[] wikiChars = getInputStreamAsCharArray(inStream, -1, encoding);
String wikiText = new String(wikiChars);
WikiModel wikiModel = new WikiModel(image, link);
String htmlStr = wikiModel.render(wikiText, false);
StringBuffer buff = new StringBuffer();
    break;
  WikiModel wikiModel = new WikiModel(image, link);
  try {
    wikiModel.setUp();

代码示例来源:origin: info.bliki.wiki/bliki-core

/**
 * Convert a given text in wiki notation into HTML text.
 *
 * @param rawWikiText
 *            a raw wiki text
 * @param resultBuffer
 *            the buffer to which to append the resulting HTML code.
 * @param imageBaseURL
 *            a url string which must contains a &quot;${image}&quot;
 *            variable which will be replaced by the image name, to create
 *            links to images.
 * @param linkBaseURL
 *            a url string which must contains a &quot;${title}&quot;
 *            variable which will be replaced by the topic title, to create
 *            links to other wiki topics.
 * @throws IOException
 */
public static void toHtml(String rawWikiText, Appendable resultBuffer,
    String imageBaseURL, String linkBaseURL) throws IOException {
  toText(new WikiModel(imageBaseURL, linkBaseURL), new HTMLConverter(),
      rawWikiText, resultBuffer, false, false);
}

代码示例来源:origin: info.bliki.wiki/bliki-core

@Override
public void process(WikiArticle article, Siteinfo siteinfo) throws IOException {
  counter++;
  if (counter >= max_counter) {
    throw new IOException("\nLimit reached after " + max_counter + " entries.");
  }
  String htmlText = "";
  WikiModel wikiModel = new WikiModel("${image}", "${title}");
  try {
    wikiModel.setUp();
    htmlText = wikiModel.render(article.getText(), false);
    if (htmlText == null) {
      System.out.println("An IOException occured!");
    } else {
      System.out.println(htmlText);
    }
  } finally {
    wikiModel.tearDown();
  }
}

代码示例来源:origin: info.bliki.wiki/bliki-core

@Override
  public void actionPerformed(java.awt.event.ActionEvent event) {
    String strData = input.getText();
    WikiModel wikiModel = new WikiModel(new Configuration(), Locale.ENGLISH, "${image}", "${title}");
    wikiModel.setUp();
    try {
      String result = wikiModel.render(strData, false);
      output.setText(result);
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      wikiModel.tearDown();
    }
  }
}

代码示例来源:origin: yahoo/FEL

html = "";
} else {
  WikiModel wikiModel = new WikiModel("image::", "external::");
  wikiModel.setUp();
  try {

代码示例来源:origin: info.bliki.wiki/bliki-core

@Override
  public void actionPerformed(java.awt.event.ActionEvent event) {
    String strData = input.getText();
    WikiModel wikiModel = new WikiModel(new Configuration(), Locale.ENGLISH, "${image}", "${title}");
    wikiModel.setUp();
    try {
      String result = wikiModel.render(new PlainTextConverter(), strData, false);
      output.setText(result);
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      wikiModel.tearDown();
    }
  }
}

代码示例来源:origin: yahoo/FEL

e1.printStackTrace();
WikiModel wikiModel = new WikiModel(this.imageBaseURL, this.linkBaseURL);
String plainText = wikiModel.render((ITextConverter)new PlainTextConverter(), article.getText());
Set<String> links = wikiModel.getLinks();

代码示例来源:origin: yahoo/FEL

this.firstPar.length( 0 );
this.title.append( URLEncoder.encode( article.getTitle().replace( ' ', '_' ) ) );
WikiModel wikiModel = new WikiModel( this.imageBaseURL, this.linkBaseURL );
String plainText = wikiModel.render( new PlainTextConverter(), article.getText() );
for( int start = 0; start < plainText.length(); ++start ) {

代码示例来源:origin: stackoverflow.com

// html to wiki
import info.bliki.html.HTML2WikiConverter;
import info.bliki.html.wikipedia.ToWikipedia;
// wiki to plain text
import info.bliki.wiki.filter.PlainTextConverter;
import info.bliki.wiki.model.WikiModel;
...
String sbodyhtml = readFile( infilepath ); //get content as string
 HTML2WikiConverter conv = new HTML2WikiConverter();
 conv.setInputHTML( sbodyhtml );
String resultwiki = conv.toWiki(new ToWikipedia());
 WikiModel wikiModel = new WikiModel("${image}", "${title}");
String plainStr = wikiModel.render(new PlainTextConverter(false), resultwiki );
System.out.println( plainStr );

相关文章