예제 #1
0
 public static String extractPlainText(String wikiMarkup) {
   MarkupParser parser = new MarkupParser();
   parser.setMarkupLanguage(new MediaWikiLanguage());
   PlaintextDocumentBuilder builder = new PlaintextDocumentBuilder();
   parser.setBuilder(builder);
   parser.parse(wikiMarkup);
   return builder.getResult();
 }
예제 #2
0
 public static String convert(String contents) {
   StringWriter writer = new StringWriter();
   HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer);
   builder.setEmitAsDocument(false);
   MarkupParser parser = new MarkupParser(new SlippLanguage());
   parser.setBuilder(builder);
   parser.parse(contents);
   return writer.toString();
 }
예제 #3
0
  @Test
  public void parse() throws Exception {
    String source = "!1234!";
    StringWriter writer = new StringWriter();
    HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer);
    builder.setEmitAsDocument(false);
    MarkupParser parser = new MarkupParser(new SlippLanguage());
    parser.setBuilder(builder);
    parser.parse(source);

    System.out.println(writer.toString());
  }