Skip to content

Instantly share code, notes, and snippets.

@oppara
Created February 22, 2011 16:21
Show Gist options
  • Save oppara/838900 to your computer and use it in GitHub Desktop.
Save oppara/838900 to your computer and use it in GitHub Desktop.
csstidy diff
diff -uBb csstidy-source-1.4.org/csstidy/main.cpp csstidy-source-1.4/csstidy/main.cpp
--- csstidy-source-1.4.org/csstidy/main.cpp 2007-07-10 10:20:54.000000000 +0900
+++ csstidy-source-1.4/csstidy/main.cpp 2011-02-23 01:04:12.000000000 +0900
@@ -73,6 +73,21 @@
predefined_templates["low"].push_back("</span>\n"); //after comment
predefined_templates["low"].push_back("\n"); // after last line @-rule
+ predefined_templates["opp"].push_back("<span class=\"at\">");
+ predefined_templates["opp"].push_back("</span> <span class=\"format\">{</span>\n");
+ predefined_templates["opp"].push_back("<span class=\"selector\">");
+ predefined_templates["opp"].push_back("</span>\n<span class=\"format\">{</span>\n");
+ predefined_templates["opp"].push_back(" <span class=\"property\">");
+ predefined_templates["opp"].push_back("</span><span class=\"value\">");
+ predefined_templates["opp"].push_back("</span><span class=\"format\">;</span>\n");
+ predefined_templates["opp"].push_back("<span class=\"format\">}</span>");
+ predefined_templates["opp"].push_back("\n\n");
+ predefined_templates["opp"].push_back("\n<span class=\"format\">}</span>\n\n");
+ predefined_templates["opp"].push_back(" ");
+ predefined_templates["opp"].push_back("<span class=\"comment\">"); // before comment
+ predefined_templates["opp"].push_back("</span>\n"); //after comment
+ predefined_templates["opp"].push_back("\n"); // after last line @-rule
+
csstidy csst;
if(argc > 1)
@@ -115,7 +130,7 @@
else if(trim(argv[i]).substr(0,11) == "--template=")
{
string template_value = trim(argv[i]).substr(11);
- if(template_value == "high" || template_value == "highest" || template_value == "low")
+ if(template_value == "high" || template_value == "highest" || template_value == "low" || template_value == "opp")
{
csst.csstemplate = predefined_templates[template_value];
}
@@ -183,7 +198,7 @@
cout << " --merge_selectors=[2|1|0] |\n";
cout << " --case_properties=[0|1|2] |\n";
cout << " --optimise_shorthands=[1|2|0] |\n";
- cout << " --template=[default|filename|low|high|highest] |\n";
+ cout << " --template=[default|filename|low|high|highest|opp] |\n";
cout << " output_filename ]*" << endl;
return EXIT_SUCCESS;
diff -uBb csstidy-source-1.4.org/csstidy/parse_css.cpp csstidy-source-1.4/csstidy/parse_css.cpp
--- csstidy-source-1.4.org/csstidy/parse_css.cpp 2007-07-10 10:21:28.000000000 +0900
+++ csstidy-source-1.4/csstidy/parse_css.cpp 2011-02-23 01:09:13.000000000 +0900
@@ -74,7 +74,7 @@
}
else if(css_input[i] == ',')
{
- cur_at = trim(cur_at) + ",";
+ cur_at = trim(cur_at) + ",\n";
}
else if(css_input[i] == '\\')
{
@@ -156,7 +156,7 @@
}
else if(css_input[i] == ',')
{
- cur_selector = trim(cur_selector) + ",";
+ cur_selector = trim(cur_selector) + ",\n";
sel_separate.push_back(cur_selector.length());
}
else if(css_input[i] == '\\')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment