コード例 #1
0
ファイル: Main.java プロジェクト: uli-heller/uli-mini-tools
 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);
 }
コード例 #2
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();
 }
コード例 #3
0
ファイル: WikiContents.java プロジェクト: architectj/slipp
 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();
 }
コード例 #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());
  }