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); }
/** * 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; }
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; }
public boolean appendStyleSheet(StyleSheet styleSheet) { appendComments(styleSheet.getOrphanComments(), false); appendAllChilds(styleSheet); return true; }