Exemple #1
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();
 }
 @Test
 public void createBuilder() {
   markupToEclipseHelp.copyrightNotice = UUID.randomUUID().toString();
   markupToEclipseHelp.title = UUID.randomUUID().toString();
   markupToEclipseHelp.htmlFilenameFormat = "$1.test.html";
   HtmlDocumentBuilder builder =
       markupToEclipseHelp.createRootBuilder(new StringWriter(), "test", "");
   assertEquals(markupToEclipseHelp.copyrightNotice, builder.getCopyrightNotice());
   assertEquals(markupToEclipseHelp.title, builder.getTitle());
   assertEquals(markupToEclipseHelp.htmlFilenameFormat, builder.getHtmlFilenameFormat());
 }
  @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());
  }
 @Override
 public void entityReference(String entity) {
   // TODO Auto-generated method stub
   super.entityReference(entity);
 }