css-annotate 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,4 +1,11 @@
1
- 2010-11-11 version 1.2.0
1
+ 2010-11-13 version 1.2.1
2
+
3
+ Fixed default syntax for CSS files.
4
+
5
+ Parsing errors now show as HTML.
6
+
7
+
8
+ 2010-11-12 version 1.2.0
2
9
 
3
10
  You can now run css-annotate as a Web server with the -s/--server option. Hit
4
11
  refresh to reload your CSS.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
@@ -3,6 +3,10 @@ body {
3
3
  padding: 0;
4
4
  font-family: "Helvetica";
5
5
  }
6
+ /* Sass errors rendered in body:before */
7
+ body:before {
8
+ color: red;
9
+ }
6
10
 
7
11
  .toggle {
8
12
  position: absolute;
@@ -1,7 +1,7 @@
1
1
  <html>
2
2
  <head>
3
3
  <title>Your CSS, annotated</title>
4
- <style><%= styles %></style>
4
+ <style><%= styles %><%= error %></style>
5
5
  <% if all? %>
6
6
  <script type="text/javascript">
7
7
  function toggle(show) {
@@ -21,23 +21,25 @@
21
21
  <% end %>
22
22
  </head>
23
23
  <body>
24
- <% if all? %>
25
- <div class="toggle">
26
- <a href="javascript:toggle(false)" rel="hide">Only commented</a>
27
- <a href="javascript:toggle(true)" rel="show">Show all</a>
28
- </div>
29
- <% end %>
30
- <table class="annotated">
31
- <% rows.each do |row| %>
32
- <tr class="<%= "commented" if row[:comment] %>">
33
- <td class="selector">
34
- <h2><%= h row[:selector] %></h2>
35
- <% if row[:comment] %><blockquote><%= h row[:comment] %></blockquote><% end %>
36
- </td>
37
- <td class="style"><pre><%= h row[:style]%></pre></td>
38
- </tr>
24
+ <% if rows %>
25
+ <% if all? %>
26
+ <div class="toggle">
27
+ <a href="javascript:toggle(false)" rel="hide">Only commented</a>
28
+ <a href="javascript:toggle(true)" rel="show">Show all</a>
29
+ </div>
39
30
  <% end %>
40
- </table>
31
+ <table class="annotated">
32
+ <% rows.each do |row| %>
33
+ <tr class="<%= "commented" if row[:comment] %>">
34
+ <td class="selector">
35
+ <h2><%= h row[:selector] %></h2>
36
+ <% if row[:comment] %><blockquote><%= h row[:comment] %></blockquote><% end %>
37
+ </td>
38
+ <td class="style"><pre><%= h row[:style]%></pre></td>
39
+ </tr>
40
+ <% end %>
41
+ </table>
42
+ <% end %>
41
43
  <div class="footer">
42
44
  Generated from <span class="filename"><%= filename %></span> on
43
45
  <%= Time.now.strftime("%c") %> by <a href="http://github.com/assaf/css-annotate">CSS Annotate</a>
data/lib/css/annotate.rb CHANGED
@@ -34,6 +34,9 @@ module CSS
34
34
  def to_html
35
35
  rows = annotate
36
36
  ERB.new(IO.read(File.dirname(__FILE__) + "/annotate/template.erb")).result(binding)
37
+ rescue Sass::SyntaxError=>error
38
+ error = Sass::SyntaxError.exception_to_css error, @options.merge(:full_exception=>true)
39
+ ERB.new(IO.read(File.dirname(__FILE__) + "/annotate/template.erb")).result(binding)
37
40
  end
38
41
 
39
42
  def styles
@@ -79,8 +82,7 @@ module CSS
79
82
  end
80
83
 
81
84
  def guess_syntax(filename)
82
- ext = File.extname(filename).sub(/^\./, "")
83
- %{css sass scss}.include?(ext) ? ext.to_sym : :scss
85
+ { ".css"=>:scss, ".sass"=>:sass, ".scss"=>:scss }[File.extname(filename)] || :scss
84
86
  end
85
87
 
86
88
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: css-annotate
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Assaf Arkin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-12 00:00:00 -08:00
18
+ date: 2010-11-13 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -92,7 +92,7 @@ licenses: []
92
92
  post_install_message: To get started, run the command css-annotate
93
93
  rdoc_options:
94
94
  - --title
95
- - css-annotate 1.2.0
95
+ - css-annotate 1.2.1
96
96
  - --main
97
97
  - README.rdoc
98
98
  - --webcvs