Package org.eclipse.mylyn.wikitext.core.parser

Examples of org.eclipse.mylyn.wikitext.core.parser.MarkupParser


  private static String renderMarkup(String content, MarkupLanguage markup,
      String pattern) {   
    markup.setInternalLinkPattern(pattern);
    StringWriter writer = new StringWriter();
    DocumentBuilder builder = new HtmlDocumentBuilder(writer);
    MarkupParser parser = new MarkupParser(markup, builder);
    parser.parse(content, false);
    return writer.toString();
  }
View Full Code Here


    };

    // avoid the <html> and <body> tags
    builder.setEmitAsDocument(false);

    MarkupParser parser = new MarkupParser(lang);
    parser.setBuilder(builder);
    parser.parse(doc.markup);
    doc.html = writer.toString();
  }
View Full Code Here

    };

    // avoid the <html> and <body> tags
    builder.setEmitAsDocument(false);

    MarkupParser parser = new MarkupParser(lang);
    parser.setBuilder(builder);
    parser.parse(doc.markup);

    final String content = writer.toString();
    final String safeContent = xssFilter.relaxed(content);

    doc.html = safeContent;
View Full Code Here

  /* (non-Javadoc)
   * @see org.opoo.press.Converter#convert(java.lang.String)
   */
  @Override
  public String convert(String content) {
    MarkupParser parser = getMarkupParser();
   
    StringWriter writer = new StringWriter();
    HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer);
    // avoid the <html> and <body> tags
    builder.setEmitAsDocument(false);

    parser.setBuilder(builder);
    parser.parse(content);
    parser.setBuilder(null);
    return writer.toString();
  }
View Full Code Here

                      break;
                    default:
                      throw new MoxieException("Unrecognized wiki syntax!");
                    }

                    MarkupParser parser = new MarkupParser(lang);
                    parser.setBuilder(builder);
                    parser.parse(hunk);

                    String htmlContent = writer.toString();

                    nomarkdownMap.put(nomarkdownKey, htmlContent);
                  } else if (nomarkdown.prettify) {
View Full Code Here

        if (topicStrategy == BreakStrategy.NONE) {
          DitaTopicDocumentBuilder builder = new DitaTopicDocumentBuilder(new DefaultXmlStreamWriter(writer),
              formatting);
          builder.setRootTopicTitle(bookTitle);

          MarkupParser parser = new MarkupParser();
          parser.setMarkupLanguage(markupLanguage);
          parser.setBuilder(builder);
          if (topicDoctype != null) {
            builder.setDoctype(topicDoctype);
          }
          builder.setFilename(outputFile.getName());
          builder.setOutline(outline);

          parser.parse(markupContent);
        } else {
          DitaBookMapDocumentBuilder builder = new DitaBookMapDocumentBuilder(
              formatting ? new FormattingXMLStreamWriter(new DefaultXmlStreamWriter(writer))
                  : new DefaultXmlStreamWriter(writer));
          try {
            builder.setFormattingDependencies(formatting);

            MarkupParser parser = new MarkupParser();
            parser.setMarkupLanguage(markupLanguage);
            parser.setBuilder(builder);

            builder.setBookTitle(bookTitle == null ? name : bookTitle);

            if (doctype != null) {
              builder.setDoctype(doctype);
            }
            if (topicDoctype != null) {
              builder.setTopicDoctype(topicDoctype);
            }
            builder.setTargetFile(outputFile);
            builder.setTopicFolder(topicFolder);
            builder.setOutline(outline);
            switch (topicStrategy) {
            case FIRST:
              if (!outline.getChildren().isEmpty()) {
                builder.setTopicBreakLevel(outline.getChildren().get(0).getLevel());
              } else {
                builder.setTopicBreakLevel(1);
              }
              break;
            case LEVEL1:
              builder.setTopicBreakLevel(1);
              break;
            }

            parser.parse(markupContent);
          } finally {
            try {
              builder.close();
            } catch (IOException e) {
              throw new BuildException(MessageFormat.format(
View Full Code Here

          configuration.setTitle(name);
        }
        builder.setConfiguration(configuration);
        builder.setBase(source.getParentFile().toURI());

        MarkupParser parser = new MarkupParser();
        parser.setMarkupLanguage(markupLanguage);
        parser.setBuilder(builder);

        parser.parse(markupContent);
      } finally {
        try {
          out.close();
        } catch (Exception e) {
          throw new BuildException(MessageFormat.format(
View Full Code Here

        splittingBuilder.setOutline(item);
        splittingBuilder.setRootFile(htmlOutputFile);
        splittingBuilder.setNavigationImages(navigationImages);
        splittingBuilder.setFormatting(formatOutput);

        MarkupParser parser = new MarkupParser();
        parser.setMarkupLanguage(markupLanguage);
        parser.setBuilder(splittingBuilder);

        parser.parse(markupContent);

        processed(markupContent, item, baseDir, source);
      } finally {
        try {
          writer.close();
View Full Code Here

          @Override
          protected XmlStreamWriter createXmlStreamWriter(Writer out) {
            return super.createFormattingXmlStreamWriter(out);
          }
        };
        MarkupParser parser = new MarkupParser();
        parser.setMarkupLanguage(markupLanguage);
        parser.setBuilder(builder);
        builder.setBookTitle(bookTitle == null ? name : bookTitle);
        if (doctype != null) {
          builder.setDoctype(doctype);
        }
        parser.parse(markupContent);
      } finally {
        try {
          writer.close();
        } catch (Exception e) {
          throw new BuildException(MessageFormat.format(
View Full Code Here

  @Override
  protected String convertMarkupFeatures(String markupText, String markupLanguageName) {
    if (markupText != null && markupLanguageName != null) {
      MarkupLanguage markupLanguage = getMarkupLanguage(markupLanguageName);
      if (markupLanguage != null) {
        MarkupParser markupParser = new MarkupParser(markupLanguage);
        return markupParser.parseToHtml(markupText);
      }
    }
    return markupText;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.mylyn.wikitext.core.parser.MarkupParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.