Package br.com.caelum.tubaina.parser

Examples of br.com.caelum.tubaina.parser.SimpleIndentator.indent()


    String options = chunk.getOptions();
    String language = detectLanguage(options);
    List<Integer> highlights = detectHighlights(options);
    boolean numbered = options.contains("#");
    SimpleIndentator simpleIndentator = new SimpleIndentator(2);
    String indentedCode = simpleIndentator.indent(chunk.getContent());
    String label = matchLabel(options);
    String pygmentsOptions = codeTagOptionsParser.parsePygmentsOptions(options);

    String code = htmlCodeHighlighter.highlight(indentedCode, language, numbered, highlights, pygmentsOptions);
View Full Code Here


  @Override
  public Chunk createChunk(String options, String content) {
      //TODO: use the real tab size, it may be different depending of which parseType is being used
      SimpleIndentator indentator = new SimpleIndentator(4);
    int maxLineLength = Utilities.maxLineLength(indentator.indent(content)) - Utilities.getMinIndent(indentator.indent(content));
    if (maxLineLength > TubainaBuilder.getCodeLength())
      throw new TubainaException ("Chapter " + ChapterBuilder.getChaptersCount() +
                    "  -  Code has " + maxLineLength + " columns out of " + TubainaBuilder.getCodeLength() + ":\n\n" + content);
    return new CodeChunk(content, options);
  }
View Full Code Here

  @Override
  public Chunk createChunk(String options, String content) {
      //TODO: use the real tab size, it may be different depending of which parseType is being used
      SimpleIndentator indentator = new SimpleIndentator(4);
    int maxLineLength = Utilities.maxLineLength(indentator.indent(content)) - Utilities.getMinIndent(indentator.indent(content));
    if (maxLineLength > TubainaBuilder.getCodeLength())
      throw new TubainaException ("Chapter " + ChapterBuilder.getChaptersCount() +
                    "  -  Code has " + maxLineLength + " columns out of " + TubainaBuilder.getCodeLength() + ":\n\n" + content);
    return new CodeChunk(content, options);
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.