Пример #1
0
void Inspect::operator()(Declaration* dec)
{
    if (dec->value()->concrete_type() == Expression::NULL_VAL) return;
    bool was_decl = in_declaration;
    in_declaration = true;
    if (output_style() == SASS_STYLE_NESTED)
        indentation += dec->tabs();
    append_indentation();
    dec->property()->perform(this);
    append_colon_separator();

    if (dec->value()->concrete_type() == Expression::SELECTOR) {
        Listize listize(*ctx);
        dec->value()->perform(&listize)->perform(this);
    } else {
        dec->value()->perform(this);
    }

    if (dec->is_important()) {
        append_optional_space();
        append_string("!important");
    }
    append_delimiter();
    if (output_style() == SASS_STYLE_NESTED)
        indentation -= dec->tabs();
    in_declaration = was_decl;
}
Пример #2
0
 void Inspect::operator()(Extension* extend)
 {
   append_indentation();
   append_token("@extend", extend);
   append_mandatory_space();
   extend->selector()->perform(this);
   append_delimiter();
 }
Пример #3
0
 void Inspect::operator()(Return* ret)
 {
   append_indentation();
   append_token("@return", ret);
   append_mandatory_space();
   ret->value()->perform(this);
   append_delimiter();
 }
Пример #4
0
 void Inspect::operator()(Debug* debug)
 {
   append_indentation();
   append_token("@debug", debug);
   append_mandatory_space();
   debug->value()->perform(this);
   append_delimiter();
 }
Пример #5
0
 void Inspect::operator()(Error* error)
 {
   append_indentation();
   append_token("@error", error);
   append_mandatory_space();
   error->message()->perform(this);
   append_delimiter();
 }
Пример #6
0
 void Inspect::operator()(Warning* warning)
 {
   append_indentation();
   append_token("@warn", warning);
   append_mandatory_space();
   warning->message()->perform(this);
   append_delimiter();
 }
Пример #7
0
 void Inspect::operator()(Import_Stub* import)
 {
   append_indentation();
   append_token("@import", import);
   append_mandatory_space();
   append_string(import->file_name());
   append_delimiter();
 }
Пример #8
0
 void Inspect::operator()(Assignment* assn)
 {
   append_token(assn->variable(), assn);
   append_colon_separator();
   assn->value()->perform(this);
   if (assn->is_default()) {
     append_optional_space();
     append_string("!default");
   }
   append_delimiter();
 }
Пример #9
0
  void Output::operator()(Directive* a)
  {
    std::string      kwd   = a->keyword();
    Selector*   s     = a->selector();
    Expression* v     = a->value();
    Block*      b     = a->block();

    append_indentation();
    append_token(kwd, a);
    if (s) {
      append_mandatory_space();
      in_wrapped = true;
      s->perform(this);
      in_wrapped = false;
    }
    if (v) {
      append_mandatory_space();
      // ruby sass bug? should use options?
      append_token(v->to_string(/* opt */), v);
    }
    if (!b) {
      append_delimiter();
      return;
    }

    if (b->is_invisible() || b->length() == 0) {
      append_optional_space();
      return append_string("{}");
    }

    append_scope_opener();

    bool format = kwd != "@font-face";;

    for (size_t i = 0, L = b->length(); i < L; ++i) {
      Statement* stm = (*b)[i];
      if (!stm->is_hoistable()) {
        stm->perform(this);
        if (i < L - 1 && format) append_special_linefeed();
      }
    }

    for (size_t i = 0, L = b->length(); i < L; ++i) {
      Statement* stm = (*b)[i];
      if (stm->is_hoistable()) {
        stm->perform(this);
        if (i < L - 1 && format) append_special_linefeed();
      }
    }

    append_scope_closer();
  }
Пример #10
0
 void Inspect::operator()(Mixin_Call* call)
 {
   append_indentation();
   append_token("@include", call);
   append_mandatory_space();
   append_string(call->name());
   if (call->arguments()) {
     call->arguments()->perform(this);
   }
   if (call->block()) {
     append_optional_space();
     call->block()->perform(this);
   }
   if (!call->block()) append_delimiter();
 }
Пример #11
0
 void Inspect::operator()(At_Rule* at_rule)
 {
   append_indentation();
   append_token(at_rule->keyword(), at_rule);
   if (at_rule->selector()) {
     append_mandatory_space();
     bool was_wrapped = in_wrapped;
     in_wrapped = true;
     at_rule->selector()->perform(this);
     in_wrapped = was_wrapped;
   }
   if (at_rule->value()) {
     append_mandatory_space();
     at_rule->value()->perform(this);
   }
   if (at_rule->block()) {
     at_rule->block()->perform(this);
   }
   else {
     append_delimiter();
   }
 }
Пример #12
0
 void Inspect::operator()(Content* content)
 {
   append_indentation();
   append_token("@content", content);
   append_delimiter();
 }