Example #1
0
 void parse(inputType inputFormat, Reader inputReader, outputType outputType, Writer outputWriter)
     throws InstantiationException, IllegalAccessException, IllegalArgumentException,
         InvocationTargetException, NoSuchMethodException, SecurityException, IOException {
   DocumentBuilder builder = outputType.getBuilder(outputWriter);
   MarkupLanguage language = inputFormat.getMarkupLanguage();
   MarkupParser parser = new MarkupParser(language, builder);
   parser.parse(inputReader);
 }
 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();
 }
Example #3
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();
 }
Example #4
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());
  }