コード例 #1
0
ファイル: CssPrinter.java プロジェクト: theogimonde/less4j
  private void appendBodySortDeclarations(Body node) {
    // this is sort of hack, bypass the usual append method
    appendComments(node.getOpeningComments(), true);

    if (!isCompressing()) cssOnly.ensureSeparator();
    append(node.getOpeningCurlyBrace());
    if (!isCompressing()) cssOnly.ensureNewLine().increaseIndentationLevel();

    Iterator<ASTCssNode> declarations = node.getDeclarations().iterator();
    List<ASTCssNode> notDeclarations = node.getNotDeclarations();
    while (declarations.hasNext()) {
      ASTCssNode declaration = declarations.next();
      append(declaration);
      if (!isCompressing() && (declarations.hasNext() || notDeclarations.isEmpty()))
        cssOnly.ensureNewLine();
    }

    appendAll(notDeclarations);

    appendComments(node.getOrphanComments(), false);
    if (!isCompressing()) cssOnly.decreaseIndentationLevel();
    append(node.getClosingCurlyBrace());

    // this is sort of hack, bypass the usual append method
    appendComments(node.getTrailingComments(), false);
  }
コード例 #2
0
ファイル: CssPrinter.java プロジェクト: theogimonde/less4j
  /**
   * returns whether the output changed as a result of the operation
   *
   * @param node
   * @return
   */
  public boolean append(ASTCssNode node) {
    // opening comments should not be docked directly in front of following
    // thing
    if (node == null || node.isSilent()) return false;

    appendComments(node.getOpeningComments(), true);
    boolean result = switchOnType(node);
    appendComments(node.getTrailingComments(), false);
    return result;
  }
コード例 #3
0
ファイル: CssPrinter.java プロジェクト: theogimonde/less4j
  private boolean appendBodyOptimizeDuplicates(Body body) {
    if (body.isEmpty()) return false;

    if (!isCompressing()) cssOnly.ensureSeparator();
    append(body.getOpeningCurlyBrace());
    if (!isCompressing()) cssOnly.ensureNewLine().increaseIndentationLevel();
    Iterable<CssPrinter> declarationsBuilders = collectUniqueBodyMembersStrings(body);
    for (CssPrinter miniBuilder : declarationsBuilders) {
      append(miniBuilder);
    }

    appendComments(body.getOrphanComments(), false);
    cssOnly.decreaseIndentationLevel();
    append(body.getClosingCurlyBrace());

    return true;
  }
コード例 #4
0
ファイル: CssPrinter.java プロジェクト: theogimonde/less4j
 public boolean appendStyleSheet(StyleSheet styleSheet) {
   appendComments(styleSheet.getOrphanComments(), false);
   appendAllChilds(styleSheet);
   return true;
 }