keydown 0.5.2 → 0.7.0

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/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use default@keydown
1
+ rvm use default@keydown --create
data/keydown.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.add_dependency 'thor', '>= 0.14.0'
16
16
  s.add_dependency 'rdiscount', '>= 1.6.8'
17
- s.add_dependency 'albino'
17
+ s.add_dependency 'coderay', '~> 0.9.8'
18
18
 
19
19
  s.add_development_dependency "rspec", ">= 2.5.0"
20
20
  s.add_development_dependency "fuubar"
@@ -1,5 +1,4 @@
1
1
  require 'digest/sha1'
2
- require 'albino'
3
2
 
4
3
  module Keydown
5
4
  class Slide
@@ -24,7 +23,7 @@ module Keydown
24
23
  extract_content!
25
24
  extract_code!
26
25
  extract_background_image!
27
- pygmentize_code!
26
+ highlight_code!
28
27
  end
29
28
 
30
29
  def classnames
@@ -109,15 +108,19 @@ module Keydown
109
108
  end
110
109
  end
111
110
 
112
- def pygmentize_code!
113
- @codemap.each do |id, spec|
114
- lang = spec[:lang]
115
- code = spec[:code]
111
+ require "coderay"
112
+
113
+ def highlight_code!
114
+ @codemap.each do |id, code_block|
115
+ lang = code_block[:lang]
116
+ code = code_block[:code]
116
117
  if code.all? { |line| line =~ /\A\r?\n\Z/ || line =~ /^( |\t)/ }
117
118
  code.gsub!(/^( |\t)/m, '')
118
119
  end
119
120
 
120
- @content.gsub!(id, Albino.new(code, lang).colorize)
121
+ tokens = CodeRay.scan code, lang.to_sym
122
+
123
+ @content.gsub!(id, tokens.html.div)
121
124
  end
122
125
  end
123
126
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Keydown
2
- VERSION = "0.5.2"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -47,9 +47,9 @@ describe Keydown::Slide do
47
47
  end
48
48
  end
49
49
 
50
- shared_examples_for "Pygmentizing code fragments" do
50
+ shared_examples_for "syntax highlighting" do
51
51
  it "should colorize the code fragments" do
52
- @doc.css('.highlight').length.should == 1
52
+ @doc.css('.CodeRay').length.should == 1
53
53
  end
54
54
  end
55
55
 
@@ -204,7 +204,7 @@ a simple note
204
204
 
205
205
  it_should_behave_like "generating HTML"
206
206
 
207
- it_should_behave_like "Pygmentizing code fragments"
207
+ it_should_behave_like "syntax highlighting"
208
208
  end
209
209
  end
210
210
 
@@ -239,7 +239,7 @@ a simple note
239
239
  end
240
240
 
241
241
  it_should_behave_like "generating HTML"
242
- it_should_behave_like "Pygmentizing code fragments"
242
+ it_should_behave_like "syntax highlighting"
243
243
  end
244
244
  end
245
245
  end
@@ -26,7 +26,7 @@ describe Keydown do
26
26
 
27
27
  it "should generate a sample Markdown file" do
28
28
  Dir.chdir "#{@tmp_dir}/sample" do
29
- File.exist?("sample.md").should be_true
29
+ File.exist?("slides.md").should be_true
30
30
  end
31
31
  end
32
32
 
@@ -0,0 +1,135 @@
1
+ /*
2
+ CSS extraction & comments via http://thoughtsincomputation.com/posts/coderay-stylesheet-classes
3
+ */
4
+
5
+ .CodeRay {
6
+ background-color: #f8f8f8;
7
+ border: 1px solid silver;
8
+ font-family: 'Courier New', 'Terminal', monospace;
9
+ color: #000;
10
+ }
11
+ .CodeRay pre { margin: 0px }
12
+
13
+ div.CodeRay { }
14
+
15
+ span.CodeRay { white-space: pre; border: 0px; padding: 2px }
16
+
17
+ table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px }
18
+ table.CodeRay td { padding: 2px 4px; vertical-align: top }
19
+
20
+ .CodeRay .line_numbers,
21
+ .CodeRay .no {
22
+ background-color: #def;
23
+ color: gray;
24
+ text-align: right;
25
+ }
26
+ .CodeRay .line_numbers tt { font-weight: bold }
27
+ .CodeRay .line_numbers .highlighted { color: red }
28
+ .CodeRay .no { padding: 0px 4px } /* (don't know) */
29
+ .CodeRay .code { width: 100% } /* (don't know) */
30
+
31
+ ol.CodeRay { font-size: 10pt }
32
+ ol.CodeRay li { white-space: pre }
33
+
34
+ .CodeRay .code pre { overflow: auto }
35
+
36
+ .CodeRay .debug { color:white ! important; background:blue ! important; } /* (don't know) */
37
+
38
+ .CodeRay .af { color:#00C } /* attribute_name_fat */
39
+ .CodeRay .an { color:#007 } /* attribute_name */
40
+ .CodeRay .at { color:#f08 } /* annotation */
41
+ .CodeRay .av { color:#700 } /* attribute_value */
42
+ .CodeRay .aw { color:#C00 } /* attribute_value_fat */
43
+ .CodeRay .bi { color:#509; font-weight:bold } /* bin */
44
+ .CodeRay .c { color:#888; } /* comment */
45
+
46
+ .CodeRay .ch { color:#04D } /* char */
47
+ .CodeRay .ch .k { color:#04D }
48
+ .CodeRay .ch .dl { color:#039 }
49
+
50
+ .CodeRay .cl { color:#B06; font-weight:bold } /* class */
51
+ .CodeRay .cm { color:#A08; font-weight:bold } /* imaginary */
52
+ .CodeRay .co { color:#036; font-weight:bold } /* constant */
53
+ .CodeRay .cr { color:#0A0 } /* color */
54
+ .CodeRay .cv { color:#369 } /* class_variable */
55
+ .CodeRay .de { color:#B0B; } /* decorator */
56
+ .CodeRay .df { color:#099; font-weight:bold } /* definition */
57
+ .CodeRay .di { color:#088; font-weight:bold } /* directive */
58
+ .CodeRay .dl { color:black } /* close */
59
+ .CodeRay .do { color:#970 } /* doc */
60
+ .CodeRay .dt { color:#34b } /* doctype */
61
+ .CodeRay .ds { color:#D42; font-weight:bold } /* doc_string */
62
+ .CodeRay .e { color:#666; font-weight:bold } /* (don't know) */
63
+ .CodeRay .en { color:#800; font-weight:bold } /* entity */
64
+ .CodeRay .er { color:#F00; background-color:#FAA } /* error */
65
+ .CodeRay .ex { color:#C00; font-weight:bold } /* exception */
66
+ .CodeRay .fl { color:#60E; font-weight:bold } /* float */
67
+ .CodeRay .fu { color:#06B; font-weight:bold } /* method */
68
+ .CodeRay .gv { color:#d70; font-weight:bold } /* global_variable */
69
+ .CodeRay .hx { color:#058; font-weight:bold } /* hex */
70
+ .CodeRay .i { color:#00D; font-weight:bold } /* integer */
71
+ .CodeRay .ic { color:#B44; font-weight:bold } /* include */
72
+
73
+ .CodeRay .il { background: #ddd; color: black } /* inline */
74
+ .CodeRay .il .il { background: #ccc }
75
+ .CodeRay .il .il .il { background: #bbb }
76
+ .CodeRay .il .idl { background: #ddd; font-weight: bold; color: #666 }
77
+ .CodeRay .idl { background-color: #bbb; font-weight: bold; color: #666; } /* inline_delimiter */
78
+
79
+ .CodeRay .im { color:#f00; } /* important */
80
+ .CodeRay .in { color:#B2B; font-weight:bold } /* interpreted */
81
+ .CodeRay .iv { color:#33B } /* instance_variable */
82
+ .CodeRay .la { color:#970; font-weight:bold } /* label */
83
+ .CodeRay .lv { color:#963 } /* local_variable */
84
+ .CodeRay .oc { color:#40E; font-weight:bold } /* oct */
85
+ .CodeRay .of { color:#000; font-weight:bold } /* operator_fat */
86
+ .CodeRay .op { } /* (don't know) */
87
+ .CodeRay .pc { color:#038; font-weight:bold } /* pre_constant */
88
+ .CodeRay .pd { color:#369; font-weight:bold } /* predefined */
89
+ .CodeRay .pp { color:#579; } /* preprocessor */
90
+ .CodeRay .ps { color:#00C; font-weight:bold } /* pseudo_class */
91
+ .CodeRay .pt { color:#074; font-weight:bold } /* pre_type */
92
+ .CodeRay .r, .kw { color:#080; font-weight:bold }
93
+
94
+ .CodeRay .ke { color: #808; } /* key */
95
+ .CodeRay .ke .dl { color: #606; }
96
+ .CodeRay .ke .ch { color: #80f; }
97
+ .CodeRay .vl { color: #088; } /* value */
98
+
99
+ .CodeRay .rx { background-color:#fff0ff } /* regexp */
100
+ .CodeRay .rx .k { color:#808 }
101
+ .CodeRay .rx .dl { color:#404 }
102
+ .CodeRay .rx .mod { color:#C2C }
103
+ .CodeRay .rx .fu { color:#404; font-weight: bold }
104
+
105
+ .CodeRay .s { background-color:#fff0f0; color: #D20; } /* string */
106
+ .CodeRay .s .s { background-color:#ffe0e0 }
107
+ .CodeRay .s .s .s { background-color:#ffd0d0 }
108
+ .CodeRay .s .k { }
109
+ .CodeRay .s .ch { color: #b0b; }
110
+ .CodeRay .s .dl { color: #710; }
111
+
112
+ .CodeRay .sh { background-color:#f0fff0; color:#2B2 } /* shell */
113
+ .CodeRay .sh .k { }
114
+ .CodeRay .sh .dl { color:#161 }
115
+
116
+ .CodeRay .sy { color:#A60 } /* symbol */
117
+ .CodeRay .sy .k { color:#A60 }
118
+ .CodeRay .sy .dl { color:#630 }
119
+
120
+ .CodeRay .ta { color:#070 } /* tag */
121
+ .CodeRay .tf { color:#070; font-weight:bold } /* tag_fat */
122
+ .CodeRay .ts { color:#D70; font-weight:bold } /* tag_special */
123
+ .CodeRay .ty { color:#339; font-weight:bold } /* type */
124
+ .CodeRay .v { color:#036 } /* variable */
125
+ .CodeRay .xt { color:#444 } /* xml_text */
126
+
127
+ .CodeRay .ins { background: #afa; } /* insert */
128
+ .CodeRay .del { background: #faa; } /* delete */
129
+ .CodeRay .chg { color: #aaf; background: #007; } /* change */
130
+ .CodeRay .head { color: #f8f; background: #505 } /* head */
131
+
132
+ .CodeRay .ins .ins { color: #080; font-weight:bold }
133
+ .CodeRay .del .del { color: #800; font-weight:bold }
134
+ .CodeRay .chg .chg { color: #66f; }
135
+ .CodeRay .head .head { color: #f4f; }
@@ -40,65 +40,3 @@ section.bulleted ul {
40
40
  .hidden {
41
41
  display: none;
42
42
  }
43
-
44
- /* - Pygments sytles for code fragments - */
45
- pre { background: none; }
46
- pre .c { color: #999988; font-style: italic } /* Comment */
47
- pre .err { color: #a61717; background-color: #e3d2d2 } /* Error */
48
- pre .k { font-weight: bold } /* Keyword */
49
- pre .o { font-weight: bold } /* Operator */
50
- pre .cm { color: #999988; font-style: italic } /* Comment.Multiline */
51
- pre .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
52
- pre .c1 { color: #999988; font-style: italic } /* Comment.Single */
53
- pre .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
54
- pre .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
55
- pre .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
56
- pre .ge { font-style: italic } /* Generic.Emph */
57
- pre .gr { color: #aa0000 } /* Generic.Error */
58
- pre .gh { color: #999999 } /* Generic.Heading */
59
- pre .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
60
- pre .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
61
- pre .go { color: #888888 } /* Generic.Output */
62
- pre .gp { color: #555555 } /* Generic.Prompt */
63
- pre .gs { font-weight: bold } /* Generic.Strong */
64
- pre .gu { color: #aaaaaa } /* Generic.Subheading */
65
- pre .gt { color: #aa0000 } /* Generic.Traceback */
66
- pre .kc { font-weight: bold } /* Keyword.Constant */
67
- pre .kd { font-weight: bold } /* Keyword.Declaration */
68
- pre .kp { font-weight: bold } /* Keyword.Pseudo */
69
- pre .kr { font-weight: bold } /* Keyword.Reserved */
70
- pre .kt { color: #445588; font-weight: bold } /* Keyword.Type */
71
- pre .m { color: #009999 } /* Literal.Number */
72
- pre .s { color: #d14 } /* Literal.String */
73
- pre .na { color: #008080 } /* Name.Attribute */
74
- pre .nb { color: #0086B3 } /* Name.Builtin */
75
- pre .nc { color: #445588; font-weight: bold } /* Name.Class */
76
- pre .no { color: #008080 } /* Name.Constant */
77
- pre .ni { color: #800080 } /* Name.Entity */
78
- pre .ne { color: #990000; font-weight: bold } /* Name.Exception */
79
- pre .nf { color: #990000; font-weight: bold } /* Name.Function */
80
- pre .nn { color: #555555 } /* Name.Namespace */
81
- pre .nt { color: #000080 } /* Name.Tag */
82
- pre .nv { color: #008080 } /* Name.Variable */
83
- pre .ow { font-weight: bold } /* Operator.Word */
84
- pre .w { color: #bbbbbb } /* Text.Whitespace */
85
- pre .mf { color: #009999 } /* Literal.Number.Float */
86
- pre .mh { color: #009999 } /* Literal.Number.Hex */
87
- pre .mi { color: #009999 } /* Literal.Number.Integer */
88
- pre .mo { color: #009999 } /* Literal.Number.Oct */
89
- pre .sb { color: #d14 } /* Literal.String.Backtick */
90
- pre .sc { color: #d14 } /* Literal.String.Char */
91
- pre .sd { color: #d14 } /* Literal.String.Doc */
92
- pre .s2 { color: #d14 } /* Literal.String.Double */
93
- pre .se { color: #d14 } /* Literal.String.Escape */
94
- pre .sh { color: #d14 } /* Literal.String.Heredoc */
95
- pre .si { color: #d14 } /* Literal.String.Interpol */
96
- pre .sx { color: #d14 } /* Literal.String.Other */
97
- pre .sr { color: #009926 } /* Literal.String.Regex */
98
- pre .s1 { color: #d14 } /* Literal.String.Single */
99
- pre .ss { color: #990073 } /* Literal.String.Symbol */
100
- pre .bp { color: #999999 } /* Name.Builtin.Pseudo */
101
- pre .vc { color: #008080 } /* Name.Variable.Class */
102
- pre .vg { color: #008080 } /* Name.Variable.Global */
103
- pre .vi { color: #008080 } /* Name.Variable.Instance */
104
- pre .il { color: #009999 } /* Literal.Number.Integer.Long */
@@ -36,7 +36,7 @@
36
36
 
37
37
  <meta charset="utf-8"/>
38
38
  <title><%= title %></title>
39
- <link href="http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans+Mono" rel="stylesheet" type="text/css"/>
39
+ <link href="http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans+Mono|Permanent+Marker|Lobster|Ruslan+Display" rel="stylesheet" type="text/css"/>
40
40
 
41
41
  <!--
42
42
  Original HTML5 Rocks CSS extracted for readability
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keydown
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 5
9
- - 2
10
- version: 0.5.2
8
+ - 7
9
+ - 0
10
+ version: 0.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Davis W. Frank
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-02 00:00:00 -07:00
18
+ date: 2011-06-28 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -51,17 +51,19 @@ dependencies:
51
51
  type: :runtime
52
52
  version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
54
- name: albino
54
+ name: coderay
55
55
  prerelease: false
56
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - ">="
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- hash: 3
61
+ hash: 43
62
62
  segments:
63
63
  - 0
64
- version: "0"
64
+ - 9
65
+ - 8
66
+ version: 0.9.8
65
67
  type: :runtime
66
68
  version_requirements: *id003
67
69
  - !ruby/object:Gem::Dependency
@@ -161,13 +163,14 @@ files:
161
163
  - spec/spec_helper.rb
162
164
  - spec/tasks/generate_spec.rb
163
165
  - spec/tasks/slides_spec.rb
164
- - templates/generate/%presentation_name%.md.tt
165
166
  - templates/generate/css/%presentation_name%.css
166
167
  - templates/generate/css/rocks.css
168
+ - templates/generate/css/syntax_highlighting.css
167
169
  - templates/generate/images/cc.large.png
168
170
  - templates/generate/images/flickr.png
169
171
  - templates/generate/js/%presentation_name%.js
170
172
  - templates/generate/js/rocks.js
173
+ - templates/generate/slides.md.tt
171
174
  - templates/keydown.css.erb
172
175
  - templates/rocks/index.rhtml
173
176
  - templates/rocks/slide.rhtml