Esempio n. 1
0
 private boolean appendSupportsLogicalOperator(SupportsLogicalOperator node) {
   if (node.getOperator() == null) {
     cssOnly.append(ERROR);
   }
   cssOnly.append(node.getOperator().getSymbol());
   return true;
 }
Esempio n. 2
0
  public boolean appendNamedExpression(NamedExpression expression) {
    cssOnly.append(expression.getName());
    cssOnly.append('=');
    append(expression.getExpression());

    return true;
  }
Esempio n. 3
0
  private boolean appendImport(Import node) {
    cssOnly.append("@import").ensureSeparator();
    append(node.getUrlExpression());
    appendCommaSeparated(node.getMediums());
    cssOnly.append(';');

    return true;
  }
Esempio n. 4
0
  private boolean appendFunctionExpression(FunctionExpression node) {
    cssOnly.append(node.getName());
    cssOnly.append('(');
    append(node.getParameter());
    cssOnly.append(')');

    return true;
  }
Esempio n. 5
0
  public boolean appendSelectorAttribute(SelectorAttribute node) {
    cssOnly.append('[');
    cssOnly.append(node.getName());
    append(node.getOperator());
    append(node.getValue());
    cssOnly.append(']');

    return true;
  }
Esempio n. 6
0
  public boolean appendPseudoClass(PseudoClass node) {
    cssAndSM.append(node.getFullName(), node.getUnderlyingStructure());
    if (node.hasParameters()) {
      cssOnly.append('(');
      append(node.getParameter());
      cssOnly.append(')');
    }

    return true;
  }
Esempio n. 7
0
 public boolean appendMediaExpression(FixedMediaExpression expression) {
   cssOnly.ensureSeparator().append('(');
   append(expression.getFeature());
   if (expression.getExpression() != null) {
     cssOnly.append(':');
     if (!isCompressing()) cssOnly.ensureSeparator();
     append(expression.getExpression());
   }
   cssOnly.append(')');
   return true;
 }
Esempio n. 8
0
  private boolean appendNumberExpression(NumberExpression node) {
    if (node.hasOriginalString()) {
      cssOnly.append(node.getOriginalString());
    } else {
      if (node.hasExpliciteSign()) {
        if (0 < node.getValueAsDouble()) cssOnly.append('+');
        else cssOnly.append('-');
      }
      cssOnly.append(PrintUtils.formatNumber(node.getValueAsDouble()) + node.getSuffix());
    }

    return true;
  }
Esempio n. 9
0
  public void appendSelectors(List<Selector> selectors) {
    selectors = filterSilent(selectors);
    // follow less.js formatting in special case - only one empty selector
    if (selectors.size() == 1 && isEmptySelector(selectors.get(0))) {
      cssOnly.append(' ');
    }

    Iterator<Selector> iterator = selectors.iterator();
    while (iterator.hasNext()) {
      Selector selector = iterator.next();
      append(selector);

      if (iterator.hasNext()) cssOnly.append(',').newLine();
    }
  }
Esempio n. 10
0
  public boolean appendCharsetDeclaration(CharsetDeclaration node) {
    cssAndSM.append("@charset", node.getUnderlyingStructure()).ensureSeparator();
    append(node.getCharset());
    cssOnly.append(';');

    return true;
  }
Esempio n. 11
0
  private boolean appendDocument(Document node) {
    cssOnly.append(node.getDialect()).ensureSeparator();

    appendCommaSeparated(node.getUrlMatchFunctions());
    append(node.getBody());
    return true;
  }
Esempio n. 12
0
 private boolean appendSupports(Supports node) {
   cssOnly.append(node.getDialect()).ensureSeparator();
   append(node.getCondition());
   cssOnly.ensureSeparator();
   append(node.getBody());
   return true;
 }
Esempio n. 13
0
  private boolean appendKeyframes(Keyframes node) {
    cssOnly.append(node.getDialect()).ensureSeparator();

    appendCommaSeparated(node.getNames());
    append(node.getBody());
    return true;
  }
Esempio n. 14
0
  private boolean appendMedia(Media node) {
    cssOnly.append("@media");
    appendCommaSeparated(node.getMediums());
    appendBodySortDeclarations(node.getBody());

    return true;
  }
Esempio n. 15
0
  private boolean appendNth(Nth node) {
    switch (node.getForm()) {
      case EVEN:
        cssOnly.append("even");
        return true;

      case ODD:
        cssOnly.append("odd");
        return true;

      case STANDARD:
        if (node.getRepeater() != null) append(node.getRepeater());
        if (node.getMod() != null) append(node.getMod());
    }

    return true;
  }
Esempio n. 16
0
  private boolean appendUnknownAtRule(UnknownAtRule node) {
    cssOnly.append(node.getName()).ensureSeparator();

    appendCommaSeparated(node.getNames());

    append(node.getBody());
    append(node.getSemicolon());
    return true;
  }
Esempio n. 17
0
  public boolean appendListExpressionOperator(ListExpressionOperator operator) {
    ListExpressionOperator.Operator realOperator = operator.getOperator();
    switch (realOperator) {
      case COMMA:
        cssOnly.append(realOperator.getSymbol());
        if (!isCompressing()) cssOnly.ensureSeparator();
        break;

      case EMPTY_OPERATOR:
        cssOnly.ensureSeparator();
        break;

      default:
        cssOnly.append(realOperator.getSymbol());
    }

    return true;
  }
Esempio n. 18
0
  public boolean appendDeclaration(Declaration declaration) {
    cssOnly.appendIgnoreNull(declaration.getNameAsString());
    cssOnly.append(':');
    if (!isCompressing()) cssOnly.ensureSeparator();
    if (declaration.getExpression() != null) append(declaration.getExpression());

    if (shouldHaveSemicolon(declaration)) cssOnly.appendIgnoreNull(";");

    return true;
  }
Esempio n. 19
0
  private boolean appendSelectorOperator(SelectorOperator operator) {
    SelectorOperator.Operator realOperator = operator.getOperator();
    switch (realOperator) {
      case NONE:
        break;

      default:
        cssOnly.append(realOperator.getSymbol());
    }
    return true;
  }
Esempio n. 20
0
  protected void appendComments(List<Comment> comments, boolean ensureSeparator) {
    if (comments == null || comments.isEmpty() || isCompressing()) return;

    cssOnly.ensureSeparator();

    for (Comment comment : comments) {
      String text = comment.getComment();
      if (text != null) cssOnly.append(text);
      if (comment.hasNewLine()) cssOnly.ensureNewLine();
    }

    if (ensureSeparator) cssOnly.ensureSeparator();
  }
Esempio n. 21
0
  public boolean appendCommaSeparated(List<? extends ASTCssNode> values) {
    boolean result = false;
    Iterator<? extends ASTCssNode> names = values.iterator();
    if (names.hasNext()) {
      result |= append(names.next());
    }
    while (names.hasNext()) {
      cssOnly.append(',');
      if (!isCompressing()) cssOnly.ensureSeparator();
      append(names.next());
      result = true;
    }

    return result;
  }
Esempio n. 22
0
  private boolean appendPage(Page node) {
    cssOnly.append("@page").ensureSeparator();
    if (node.hasName()) {
      append(node.getName());
      if (!node.hasDockedPseudopage()) cssOnly.ensureSeparator();
    }

    if (node.hasPseudopage()) {
      append(node.getPseudopage());
      cssOnly.ensureSeparator();
    }

    appendBodySortDeclarations(node.getBody());
    return true;
  }
Esempio n. 23
0
  public boolean appendBinaryExpressionOperator(BinaryExpressionOperator operator) {
    BinaryExpressionOperator.Operator realOperator = operator.getOperator();
    switch (realOperator) {
        // TODO this is a huge hack which goes around
        // "we do not parse fonts and less.js does" lack of feature
        // left here intentionally, so we can have correct unit test and can come
        // back to it later
      case MINUS:
        cssOnly.ensureSeparator().append('-');
        break;

      default:
        cssOnly.append(realOperator.getSymbol());
    }

    return true;
  }
Esempio n. 24
0
 protected boolean appendColorExpression(ColorExpression expression) {
   cssOnly.append(expression.getValue());
   return true;
 }
Esempio n. 25
0
  public boolean appendUnicodeRangeExpression(UnicodeRangeExpression expression) {
    cssOnly.append(expression.getValue());

    return true;
  }
Esempio n. 26
0
  public boolean appendIdentifierExpression(IdentifierExpression expression) {
    cssOnly.append(expression.getValue());

    return true;
  }
Esempio n. 27
0
  public boolean appendEmbeddedScript(EmbeddedScript escaped) {
    cssOnly.append(escaped.getValue());

    return true;
  }
Esempio n. 28
0
  public boolean appendEscapedValue(EscapedValue escaped) {
    cssOnly.append(escaped.getValue());

    return true;
  }
Esempio n. 29
0
  public boolean appendCssString(CssString expression) {
    String quoteType = expression.getQuoteType();
    cssOnly.append(quoteType).append(expression.getValue()).append(quoteType);

    return true;
  }
Esempio n. 30
0
 public boolean appendMediaExpressionFeature(MediaExpressionFeature feature) {
   cssOnly.append(feature.getFeature());
   return true;
 }