rack-codehighlighter 0.4.4 → 0.4.5

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.
@@ -30,7 +30,7 @@ highlighter.
30
30
 
31
31
  Install the gem with:
32
32
 
33
- sudo gem install rack-codehighlighter -s http://gemcutter.org
33
+ sudo gem install rack-codehighlighter
34
34
 
35
35
  In order for the highlighting to show up, you’ll need to include a
36
36
  highlighting stylesheet. For example stylesheets you can look at
@@ -146,7 +146,13 @@ This change confuses both rack-codehighlighter and the highlighters
146
146
  themselves (e.g. Ultraviolet and Coderay). So, to support `pre` tags
147
147
  as rendered by HAML, `
` was added to the default pattern.
148
148
 
149
- Check the `examples` directory for working examples.
149
+ The *examples* directory contains several rackup files.
150
+ Each rackup file uses a different highlighter.
151
+ Install the *shotgun* gem and try, for example, the Pygments highlighter:
152
+
153
+ shotgun pygments.ru
154
+
155
+ The results could be checked at *http://localhost:9393*.
150
156
 
151
157
 
152
158
  ## Try it!
@@ -1,5 +1,5 @@
1
1
  ---
2
+ :minor: 4
2
3
  :build:
3
- :patch: 4
4
+ :patch: 5
4
5
  :major: 0
5
- :minor: 4
@@ -0,0 +1,8 @@
1
+ require 'app'
2
+
3
+ use Rack::ShowExceptions
4
+ use Rack::Lint
5
+
6
+ use Rack::Codehighlighter, :prettify, :element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => true
7
+
8
+ run Sinatra::Application
@@ -3,17 +3,6 @@ require 'app'
3
3
  use Rack::ShowExceptions
4
4
  use Rack::Lint
5
5
 
6
- # use default options
7
-
8
- #use Rack::Codehighlighter, :prettify, :element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => true
9
-
10
- #use Rack::Codehighlighter, :coderay, :element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => true
11
-
12
- #use Rack::Codehighlighter, :syntax, :element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => true
13
-
14
- use Rack::Codehighlighter, :ultraviolet, :theme => 'dawn',
15
- :element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => true
16
-
17
- #use Rack::Codehighlighter, :censor, :reason => '[[-- ugly code removed --]]'
6
+ use Rack::Codehighlighter, :censor, :reason => '[[-- ugly code removed --]]'
18
7
 
19
8
  run Sinatra::Application
@@ -0,0 +1,61 @@
1
+ .hll { background-color: #ffffcc }
2
+ .c { color: #408080; font-style: italic } /* Comment */
3
+ .err { border: 1px solid #FF0000 } /* Error */
4
+ .k { color: #008000; font-weight: bold } /* Keyword */
5
+ .o { color: #666666 } /* Operator */
6
+ .cm { color: #408080; font-style: italic } /* Comment.Multiline */
7
+ .cp { color: #BC7A00 } /* Comment.Preproc */
8
+ .c1 { color: #408080; font-style: italic } /* Comment.Single */
9
+ .cs { color: #408080; font-style: italic } /* Comment.Special */
10
+ .gd { color: #A00000 } /* Generic.Deleted */
11
+ .ge { font-style: italic } /* Generic.Emph */
12
+ .gr { color: #FF0000 } /* Generic.Error */
13
+ .gh { color: #000080; font-weight: bold } /* Generic.Heading */
14
+ .gi { color: #00A000 } /* Generic.Inserted */
15
+ .go { color: #808080 } /* Generic.Output */
16
+ .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
17
+ .gs { font-weight: bold } /* Generic.Strong */
18
+ .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
19
+ .gt { color: #0040D0 } /* Generic.Traceback */
20
+ .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
21
+ .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
22
+ .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
23
+ .kp { color: #008000 } /* Keyword.Pseudo */
24
+ .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
25
+ .kt { color: #B00040 } /* Keyword.Type */
26
+ .m { color: #666666 } /* Literal.Number */
27
+ .s { color: #BA2121 } /* Literal.String */
28
+ .na { color: #7D9029 } /* Name.Attribute */
29
+ .nb { color: #008000 } /* Name.Builtin */
30
+ .nc { color: #0000FF; font-weight: bold } /* Name.Class */
31
+ .no { color: #880000 } /* Name.Constant */
32
+ .nd { color: #AA22FF } /* Name.Decorator */
33
+ .ni { color: #999999; font-weight: bold } /* Name.Entity */
34
+ .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
35
+ .nf { color: #0000FF } /* Name.Function */
36
+ .nl { color: #A0A000 } /* Name.Label */
37
+ .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
38
+ .nt { color: #008000; font-weight: bold } /* Name.Tag */
39
+ .nv { color: #19177C } /* Name.Variable */
40
+ .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
41
+ .w { color: #bbbbbb } /* Text.Whitespace */
42
+ .mf { color: #666666 } /* Literal.Number.Float */
43
+ .mh { color: #666666 } /* Literal.Number.Hex */
44
+ .mi { color: #666666 } /* Literal.Number.Integer */
45
+ .mo { color: #666666 } /* Literal.Number.Oct */
46
+ .sb { color: #BA2121 } /* Literal.String.Backtick */
47
+ .sc { color: #BA2121 } /* Literal.String.Char */
48
+ .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
49
+ .s2 { color: #BA2121 } /* Literal.String.Double */
50
+ .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
51
+ .sh { color: #BA2121 } /* Literal.String.Heredoc */
52
+ .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
53
+ .sx { color: #008000 } /* Literal.String.Other */
54
+ .sr { color: #BB6688 } /* Literal.String.Regex */
55
+ .s1 { color: #BA2121 } /* Literal.String.Single */
56
+ .ss { color: #19177C } /* Literal.String.Symbol */
57
+ .bp { color: #008000 } /* Name.Builtin.Pseudo */
58
+ .vc { color: #19177C } /* Name.Variable.Class */
59
+ .vg { color: #19177C } /* Name.Variable.Global */
60
+ .vi { color: #19177C } /* Name.Variable.Instance */
61
+ .il { color: #666666 } /* Literal.Number.Integer.Long */
@@ -0,0 +1,9 @@
1
+ require 'app'
2
+
3
+ use Rack::ShowExceptions
4
+ use Rack::Lint
5
+
6
+ use Rack::Codehighlighter, :pygments_api, :element => "pre",
7
+ :pattern => /\A:::([-_+\w]+)\s*\n/, :logging => true
8
+
9
+ run Sinatra::Application
@@ -0,0 +1,11 @@
1
+ require 'app'
2
+
3
+ use Rack::ShowExceptions
4
+ use Rack::Lint
5
+
6
+ use Rack::Codehighlighter, :ultraviolet,
7
+ :element => "pre", :pattern => /\A:::(\w+)\s*\n/,
8
+ :themes => {"cobalt" => ["ruby"], "zenburnesque" => ["c", "sql"]},
9
+ :logging => true
10
+
11
+ run Sinatra::Application
@@ -11,19 +11,6 @@ void hello(void) {
11
11
  }
12
12
  </pre>
13
13
 
14
- <h3>html</h3>
15
-
16
- <pre>:::html
17
- <html>
18
- <head>
19
- <title>hello world</title>
20
- </head>
21
- <body>
22
- <h1>hello world</h1>
23
- </body>
24
- </html>
25
- </pre>
26
-
27
14
  <h3>ruby </h3>
28
15
 
29
16
  <pre>:::ruby
@@ -50,7 +37,7 @@ body {
50
37
  }
51
38
  </pre>
52
39
 
53
- <h3>sqlite</h3>
40
+ <h3>sql</h3>
54
41
 
55
42
  <pre>:::sql
56
43
  drop table if exists exams;
@@ -61,21 +48,3 @@ create table exams (
61
48
  when datetime
62
49
  );
63
50
  </pre>
64
-
65
- <h3>javascript</h3>
66
-
67
- <pre>:::javascript
68
- for (var i = 0, length = properties.length; i < length; i++) {
69
- var property = properties[i], value = source[property];
70
- if (ancestor && Object.isFunction(value) &&
71
- value.argumentNames().first() == "$super") {
72
- var method = value, value = Object.extend((function(m) {
73
- return function() { return ancestor[m].apply(this, arguments) };
74
- })(property).wrap(method), {
75
- valueOf: function() { return method },
76
- toString: function() { return method.toString() }
77
- });
78
- }
79
- this.prototype[property] = value;
80
- }
81
- </pre>
@@ -1,4 +1,3 @@
1
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/html4/strict.dtd">
2
1
  <html>
3
2
  <head>
4
3
  <meta http-equiv="Content-type" content="text/html; charset=utf-8">
@@ -10,6 +9,8 @@
10
9
  type="text/css" media="screen" charset="utf-8">
11
10
  <link rel="stylesheet" href="/stylesheets/uv.css"
12
11
  type="text/css" media="screen" charset="utf-8">
12
+ <link rel="stylesheet" href="/stylesheets/pygments.css"
13
+ type="text/css" media="screen" charset="utf-8">
13
14
  <link rel="stylesheet" href="/stylesheets/censor.css"
14
15
  type="text/css" media="screen" charset="utf-8"/>
15
16
 
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-codehighlighter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 5
9
+ version: 0.4.5
5
10
  platform: ruby
6
11
  authors:
7
12
  - Wlodek Bzyl
@@ -9,39 +14,51 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-14 00:00:00 +01:00
17
+ date: 2010-02-26 00:00:00 +01:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: rack
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 0
30
+ - 0
23
31
  version: 1.0.0
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: nokogiri
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 4
44
+ - 1
33
45
  version: 1.4.1
34
- version:
46
+ type: :runtime
47
+ version_requirements: *id002
35
48
  - !ruby/object:Gem::Dependency
36
49
  name: rack-test
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
40
52
  requirements:
41
53
  - - ">="
42
54
  - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ - 3
58
+ - 0
43
59
  version: 0.3.0
44
- version:
60
+ type: :development
61
+ version_requirements: *id003
45
62
  description: Rack Middleware for Code Highlighting.
46
63
  email: matwb@univ.gda.pl
47
64
  executables: []
@@ -59,6 +76,7 @@ files:
59
76
  - VERSION.yml
60
77
  - examples/app.rb
61
78
  - examples/check.rb
79
+ - examples/coderay.ru
62
80
  - examples/config.ru
63
81
  - examples/public/javascripts/lang-css.js
64
82
  - examples/public/javascripts/lang-hs.js
@@ -74,6 +92,7 @@ files:
74
92
  - examples/public/stylesheets/censor.css
75
93
  - examples/public/stylesheets/coderay.css
76
94
  - examples/public/stylesheets/prettify.css
95
+ - examples/public/stylesheets/pygments.css
77
96
  - examples/public/stylesheets/syntax.css
78
97
  - examples/public/stylesheets/uv.css
79
98
  - examples/public/stylesheets/uv/amy.css
@@ -84,6 +103,8 @@ files:
84
103
  - examples/public/stylesheets/uv/sunburst.css
85
104
  - examples/public/stylesheets/uv/twilight.css
86
105
  - examples/public/stylesheets/uv/zenburnesque.css
106
+ - examples/pygments.ru
107
+ - examples/ultraviolet.ru
87
108
  - examples/views/index.erb
88
109
  - examples/views/layout.erb
89
110
  - lib/rack/codehighlighter.rb
@@ -101,18 +122,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
122
  requirements:
102
123
  - - ">="
103
124
  - !ruby/object:Gem::Version
125
+ segments:
126
+ - 0
104
127
  version: "0"
105
- version:
106
128
  required_rubygems_version: !ruby/object:Gem::Requirement
107
129
  requirements:
108
130
  - - ">="
109
131
  - !ruby/object:Gem::Version
132
+ segments:
133
+ - 0
110
134
  version: "0"
111
- version:
112
135
  requirements: []
113
136
 
114
137
  rubyforge_project:
115
- rubygems_version: 1.3.5
138
+ rubygems_version: 1.3.6
116
139
  signing_key:
117
140
  specification_version: 3
118
141
  summary: Rack Middleware for Code Highlighting.