Skip to content

Commit

Permalink
Fixes an edge case with compact @font-face output
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreter committed May 9, 2015
1 parent 99f60f8 commit 265ced8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions emitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ namespace Sass {
bool scheduled_delimiter;

public:
// output strings different in comments
bool in_comment;
// selector list does not get linefeeds
bool in_wrapped;
// lists always get a space after delimiter
bool in_media_block;
// nested list must not have parentheses
bool in_declaration;
// nested lists need parentheses
bool in_space_array;
bool in_comma_array;

Expand Down
12 changes: 7 additions & 5 deletions inspect.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#include "inspect.hpp"
#include "ast.hpp"
#include "context.hpp"
#include "utf8/checked.h"
#include <cmath>
#include <string>
#include <iostream>
#include <iomanip>
#include <stdint.h>
#include <stdint.h>

#include "ast.hpp"
#include "inspect.hpp"
#include "context.hpp"
#include "utf8/checked.h"

namespace Sass {
using namespace std;

Expand Down Expand Up @@ -99,9 +100,10 @@ namespace Sass {
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 = false;
in_wrapped = was_wrapped;
}
if (at_rule->block()) {
at_rule->block()->perform(this);
Expand Down
6 changes: 4 additions & 2 deletions output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,19 +349,21 @@ namespace Sass {

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) append_special_linefeed();
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) append_special_linefeed();
if (i < L - 1 && format) append_special_linefeed();
}
}

Expand Down

0 comments on commit 265ced8

Please sign in to comment.