prezio 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  <style>
2
2
  .highlight {
3
+ font-size: 0.8em;
3
4
  background-color: #FDF6E3;
4
5
  border-radius: 5px;
5
6
  box-shadow: 5px 5px 5px #ccc;
@@ -90,4 +91,4 @@
90
91
  .highlight .vg { color: #268BD2 } /* Name.Variable.Global */
91
92
  .highlight .vi { color: #268BD2 } /* Name.Variable.Instance */
92
93
  .highlight .il { color: #2AA198 } /* Literal.Number.Integer.Long */
93
- .highlight </style>
94
+ </style>
@@ -23,8 +23,8 @@ module Prezio
23
23
  private
24
24
 
25
25
  def replace_code_tags(doc)
26
- doc.css("code").each do |node|
27
- node.replace(highlight(node))
26
+ doc.css("script").each do |node|
27
+ node.replace(highlight(node)) if node['lang']
28
28
  end
29
29
  end
30
30
 
@@ -1,3 +1,3 @@
1
1
  module Prezio
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -13,15 +13,17 @@
13
13
 
14
14
  <section>
15
15
  <!-- This will be highlighted -->
16
- <code lang="ruby">
17
- def greet(name)
18
- println "Hello, #{name}!"
16
+ <script lang="ruby">
17
+ class Foo < Bar
18
+ def greet(name)
19
+ println "Hello, #{name}!"
20
+ end
19
21
  end
20
22
 
21
23
  def foo
22
24
 
23
25
  end
24
- </code>
26
+ </script>
25
27
  </section>
26
28
 
27
29
  <section>
@@ -4,19 +4,21 @@ describe Prezio::SyntaxHighlighter do
4
4
  HTML = <<-HTML
5
5
  <section>welcome</section>
6
6
 
7
+ <script type="text/javascript">alert('hello');</script>
8
+
7
9
  <section>
8
- <code lang="ruby">
10
+ <script lang="ruby">
9
11
  def hello
10
12
  puts "hello ruby"
11
13
  end
12
- </code>
14
+ </script>
13
15
  </section>
14
16
 
15
17
  <section>
16
- <code lang="python">
18
+ <script lang="python">
17
19
  def hello():
18
20
  print "hello python"
19
- </code>
21
+ </script>
20
22
  </section>
21
23
 
22
24
  <section>goodbye</section>
@@ -35,6 +37,10 @@ describe Prezio::SyntaxHighlighter do
35
37
  result.should include('hello python')
36
38
  end
37
39
 
40
+ it "does not replace regular script tags" do
41
+ result.should include(%q{<script type="text/javascript">alert('hello');</script>})
42
+ end
43
+
38
44
  it "does not add body/html tags to content" do
39
45
  result.should_not include('body')
40
46
  result.should_not include('html')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prezio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-22 00:00:00.000000000 Z
12
+ date: 2012-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
@@ -149,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  segments:
151
151
  - 0
152
- hash: -661907091
152
+ hash: -1029809919
153
153
  required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  none: false
155
155
  requirements:
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  segments:
160
160
  - 0
161
- hash: -661907091
161
+ hash: -1029809919
162
162
  requirements: []
163
163
  rubyforge_project:
164
164
  rubygems_version: 1.8.24