Package com.cadrlife.jhaml.internal

Examples of com.cadrlife.jhaml.internal.Line


  private List<Line> processNesting(List<Line> lines) {
    int indentSize = -1;
    List<Line> lineTree = new ArrayList<Line>();
    for (Line line : lines) {
     
      Line parentLine = parentLine(line, lineTree);
      if (parentLine != null) {
        if (indentSize == -1) {
          indentSize = line.leadingWhitespace.length() - parentLine.leadingWhitespace.length();
        }
        line.indentation = parentLine.indentation + "  ";
        if (parentLine.isFilter()) {
          line.isWithinFilter = true;
        }
        if (line.isBlank() && !line.isWithinFilter) {
          continue;
        }
View Full Code Here


    }
    return lineTree;
  }
 
  private Line parentLine(Line childLine, List<Line> lineTree) {
    Line lastLine = null;
    for (Line line : lineTree) {
      if (!line.isBlank() && !line.isWithinFilter) {
        lastLine = line;
      }
    }
    if (lastLine != null) {
      if (isDeeper(lastLine, childLine) || childLine.isBlank()) {
        if (childLine.isBlank() && !lastLine.canHaveNesting()) {
          return null;
        }
        Line innerParent = parentLine(childLine, lastLine.block);
        return innerParent == null ? lastLine : innerParent;
      }
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of com.cadrlife.jhaml.internal.Line

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.