rouge-rails 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +88 -0
  8. data/Rakefile +6 -0
  9. data/app/assets/stylesheets/rouge/autumn.scss +60 -0
  10. data/app/assets/stylesheets/rouge/borland.scss +48 -0
  11. data/app/assets/stylesheets/rouge/bw.scss +36 -0
  12. data/app/assets/stylesheets/rouge/colorful.scss +63 -0
  13. data/app/assets/stylesheets/rouge/colorschemes.scss +22 -0
  14. data/app/assets/stylesheets/rouge/default.scss +64 -0
  15. data/app/assets/stylesheets/rouge/emacs.scss +63 -0
  16. data/app/assets/stylesheets/rouge/friendly.scss +63 -0
  17. data/app/assets/stylesheets/rouge/fruity.scss +71 -0
  18. data/app/assets/stylesheets/rouge/github.scss +63 -0
  19. data/app/assets/stylesheets/rouge/manni.scss +63 -0
  20. data/app/assets/stylesheets/rouge/monokai.scss +66 -0
  21. data/app/assets/stylesheets/rouge/murphy.scss +63 -0
  22. data/app/assets/stylesheets/rouge/native.scss +71 -0
  23. data/app/assets/stylesheets/rouge/pastie.scss +62 -0
  24. data/app/assets/stylesheets/rouge/perldoc.scss +60 -0
  25. data/app/assets/stylesheets/rouge/solarized-dark.scss +72 -0
  26. data/app/assets/stylesheets/rouge/solarized-light.scss +72 -0
  27. data/app/assets/stylesheets/rouge/tango.scss +71 -0
  28. data/app/assets/stylesheets/rouge/trac.scss +61 -0
  29. data/app/assets/stylesheets/rouge/vim.scss +71 -0
  30. data/app/assets/stylesheets/rouge/vs.scss +35 -0
  31. data/app/assets/stylesheets/rouge/zenburn.scss +74 -0
  32. data/app/assets/stylesheets/rouge.scss +1 -0
  33. data/app/helpers/rouge_helper.rb +5 -0
  34. data/bin/console +7 -0
  35. data/bin/setup +8 -0
  36. data/lib/rouge/rails/configuration.rb +17 -0
  37. data/lib/rouge/rails/engine.rb +4 -0
  38. data/lib/rouge/rails/railtie.rb +10 -0
  39. data/lib/rouge/rails/template_handler.rb +45 -0
  40. data/lib/rouge/rails/version.rb +5 -0
  41. data/lib/rouge/rails.rb +10 -0
  42. data/rouge-rails.gemspec +28 -0
  43. metadata +183 -0
@@ -0,0 +1,71 @@
1
+ .highlight.tango {
2
+ .hll { background-color: #ffffcc }
3
+ .c { color: #8f5902; font-style: italic } /* Comment */
4
+ .err { color: #a40000; border: 1px solid #ef2929 } /* Error */
5
+ .g { color: #000000 } /* Generic */
6
+ .k { color: #204a87; font-weight: bold } /* Keyword */
7
+ .l { color: #000000 } /* Literal */
8
+ .n { color: #000000 } /* Name */
9
+ .o { color: #ce5c00; font-weight: bold } /* Operator */
10
+ .x { color: #000000 } /* Other */
11
+ .p { color: #000000; font-weight: bold } /* Punctuation */
12
+ .cm { color: #8f5902; font-style: italic } /* Comment.Multiline */
13
+ .cp { color: #8f5902; font-style: italic } /* Comment.Preproc */
14
+ .c1 { color: #8f5902; font-style: italic } /* Comment.Single */
15
+ .cs { color: #8f5902; font-style: italic } /* Comment.Special */
16
+ .gd { color: #a40000 } /* Generic.Deleted */
17
+ .ge { color: #000000; font-style: italic } /* Generic.Emph */
18
+ .gr { color: #ef2929 } /* Generic.Error */
19
+ .gh { color: #000080; font-weight: bold } /* Generic.Heading */
20
+ .gi { color: #00A000 } /* Generic.Inserted */
21
+ .go { color: #000000; font-style: italic } /* Generic.Output */
22
+ .gp { color: #8f5902 } /* Generic.Prompt */
23
+ .gs { color: #000000; font-weight: bold } /* Generic.Strong */
24
+ .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
25
+ .gt { color: #a40000; font-weight: bold } /* Generic.Traceback */
26
+ .kc { color: #204a87; font-weight: bold } /* Keyword.Constant */
27
+ .kd { color: #204a87; font-weight: bold } /* Keyword.Declaration */
28
+ .kn { color: #204a87; font-weight: bold } /* Keyword.Namespace */
29
+ .kp { color: #204a87; font-weight: bold } /* Keyword.Pseudo */
30
+ .kr { color: #204a87; font-weight: bold } /* Keyword.Reserved */
31
+ .kt { color: #204a87; font-weight: bold } /* Keyword.Type */
32
+ .ld { color: #000000 } /* Literal.Date */
33
+ .m { color: #0000cf; font-weight: bold } /* Literal.Number */
34
+ .s { color: #4e9a06 } /* Literal.String */
35
+ .na { color: #c4a000 } /* Name.Attribute */
36
+ .nb { color: #204a87 } /* Name.Builtin */
37
+ .nc { color: #000000 } /* Name.Class */
38
+ .no { color: #000000 } /* Name.Constant */
39
+ .nd { color: #5c35cc; font-weight: bold } /* Name.Decorator */
40
+ .ni { color: #ce5c00 } /* Name.Entity */
41
+ .ne { color: #cc0000; font-weight: bold } /* Name.Exception */
42
+ .nf { color: #000000 } /* Name.Function */
43
+ .nl { color: #f57900 } /* Name.Label */
44
+ .nn { color: #000000 } /* Name.Namespace */
45
+ .nx { color: #000000 } /* Name.Other */
46
+ .py { color: #000000 } /* Name.Property */
47
+ .nt { color: #204a87; font-weight: bold } /* Name.Tag */
48
+ .nv { color: #000000 } /* Name.Variable */
49
+ .ow { color: #204a87; font-weight: bold } /* Operator.Word */
50
+ .w { color: #f8f8f8; text-decoration: underline } /* Text.Whitespace */
51
+ .mf { color: #0000cf; font-weight: bold } /* Literal.Number.Float */
52
+ .mh { color: #0000cf; font-weight: bold } /* Literal.Number.Hex */
53
+ .mi { color: #0000cf; font-weight: bold } /* Literal.Number.Integer */
54
+ .mo { color: #0000cf; font-weight: bold } /* Literal.Number.Oct */
55
+ .sb { color: #4e9a06 } /* Literal.String.Backtick */
56
+ .sc { color: #4e9a06 } /* Literal.String.Char */
57
+ .sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */
58
+ .s2 { color: #4e9a06 } /* Literal.String.Double */
59
+ .se { color: #4e9a06 } /* Literal.String.Escape */
60
+ .sh { color: #4e9a06 } /* Literal.String.Heredoc */
61
+ .si { color: #4e9a06 } /* Literal.String.Interpol */
62
+ .sx { color: #4e9a06 } /* Literal.String.Other */
63
+ .sr { color: #4e9a06 } /* Literal.String.Regex */
64
+ .s1 { color: #4e9a06 } /* Literal.String.Single */
65
+ .ss { color: #4e9a06 } /* Literal.String.Symbol */
66
+ .bp { color: #3465a4 } /* Name.Builtin.Pseudo */
67
+ .vc { color: #000000 } /* Name.Variable.Class */
68
+ .vg { color: #000000 } /* Name.Variable.Global */
69
+ .vi { color: #000000 } /* Name.Variable.Instance */
70
+ .il { color: #0000cf; font-weight: bold } /* Literal.Number.Integer.Long */
71
+ }
@@ -0,0 +1,61 @@
1
+ .highlight.trac {
2
+ .hll { background-color: #ffffcc }
3
+ .c { color: #999988; font-style: italic } /* Comment */
4
+ .err { color: #a61717; background-color: #e3d2d2 } /* Error */
5
+ .k { font-weight: bold } /* Keyword */
6
+ .o { font-weight: bold } /* Operator */
7
+ .cm { color: #999988; font-style: italic } /* Comment.Multiline */
8
+ .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
9
+ .c1 { color: #999988; font-style: italic } /* Comment.Single */
10
+ .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
11
+ .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
12
+ .ge { font-style: italic } /* Generic.Emph */
13
+ .gr { color: #aa0000 } /* Generic.Error */
14
+ .gh { color: #999999 } /* Generic.Heading */
15
+ .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
16
+ .go { color: #888888 } /* Generic.Output */
17
+ .gp { color: #555555 } /* Generic.Prompt */
18
+ .gs { font-weight: bold } /* Generic.Strong */
19
+ .gu { color: #aaaaaa } /* Generic.Subheading */
20
+ .gt { color: #aa0000 } /* Generic.Traceback */
21
+ .kc { font-weight: bold } /* Keyword.Constant */
22
+ .kd { font-weight: bold } /* Keyword.Declaration */
23
+ .kn { font-weight: bold } /* Keyword.Namespace */
24
+ .kp { font-weight: bold } /* Keyword.Pseudo */
25
+ .kr { font-weight: bold } /* Keyword.Reserved */
26
+ .kt { color: #445588; font-weight: bold } /* Keyword.Type */
27
+ .m { color: #009999 } /* Literal.Number */
28
+ .s { color: #bb8844 } /* Literal.String */
29
+ .na { color: #008080 } /* Name.Attribute */
30
+ .nb { color: #999999 } /* Name.Builtin */
31
+ .nc { color: #445588; font-weight: bold } /* Name.Class */
32
+ .no { color: #008080 } /* Name.Constant */
33
+ .ni { color: #800080 } /* Name.Entity */
34
+ .ne { color: #990000; font-weight: bold } /* Name.Exception */
35
+ .nf { color: #990000; font-weight: bold } /* Name.Function */
36
+ .nn { color: #555555 } /* Name.Namespace */
37
+ .nt { color: #000080 } /* Name.Tag */
38
+ .nv { color: #008080 } /* Name.Variable */
39
+ .ow { font-weight: bold } /* Operator.Word */
40
+ .w { color: #bbbbbb } /* Text.Whitespace */
41
+ .mf { color: #009999 } /* Literal.Number.Float */
42
+ .mh { color: #009999 } /* Literal.Number.Hex */
43
+ .mi { color: #009999 } /* Literal.Number.Integer */
44
+ .mo { color: #009999 } /* Literal.Number.Oct */
45
+ .sb { color: #bb8844 } /* Literal.String.Backtick */
46
+ .sc { color: #bb8844 } /* Literal.String.Char */
47
+ .sd { color: #bb8844 } /* Literal.String.Doc */
48
+ .s2 { color: #bb8844 } /* Literal.String.Double */
49
+ .se { color: #bb8844 } /* Literal.String.Escape */
50
+ .sh { color: #bb8844 } /* Literal.String.Heredoc */
51
+ .si { color: #bb8844 } /* Literal.String.Interpol */
52
+ .sx { color: #bb8844 } /* Literal.String.Other */
53
+ .sr { color: #808000 } /* Literal.String.Regex */
54
+ .s1 { color: #bb8844 } /* Literal.String.Single */
55
+ .ss { color: #bb8844 } /* Literal.String.Symbol */
56
+ .bp { color: #999999 } /* Name.Builtin.Pseudo */
57
+ .vc { color: #008080 } /* Name.Variable.Class */
58
+ .vg { color: #008080 } /* Name.Variable.Global */
59
+ .vi { color: #008080 } /* Name.Variable.Instance */
60
+ .il { color: #009999 } /* Literal.Number.Integer.Long */
61
+ }
@@ -0,0 +1,71 @@
1
+ .highlight.vim {
2
+ .hll { background-color: #222222 }
3
+ .c { color: #000080 } /* Comment */
4
+ .err { color: #cccccc; border: 1px solid #FF0000 } /* Error */
5
+ .g { color: #cccccc } /* Generic */
6
+ .k { color: #cdcd00 } /* Keyword */
7
+ .l { color: #cccccc } /* Literal */
8
+ .n { color: #cccccc } /* Name */
9
+ .o { color: #3399cc } /* Operator */
10
+ .x { color: #cccccc } /* Other */
11
+ .p { color: #cccccc } /* Punctuation */
12
+ .cm { color: #000080 } /* Comment.Multiline */
13
+ .cp { color: #000080 } /* Comment.Preproc */
14
+ .c1 { color: #000080 } /* Comment.Single */
15
+ .cs { color: #cd0000; font-weight: bold } /* Comment.Special */
16
+ .gd { color: #cd0000 } /* Generic.Deleted */
17
+ .ge { color: #cccccc; font-style: italic } /* Generic.Emph */
18
+ .gr { color: #FF0000 } /* Generic.Error */
19
+ .gh { color: #000080; font-weight: bold } /* Generic.Heading */
20
+ .gi { color: #00cd00 } /* Generic.Inserted */
21
+ .go { color: #808080 } /* Generic.Output */
22
+ .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
23
+ .gs { color: #cccccc; font-weight: bold } /* Generic.Strong */
24
+ .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
25
+ .gt { color: #0040D0 } /* Generic.Traceback */
26
+ .kc { color: #cdcd00 } /* Keyword.Constant */
27
+ .kd { color: #00cd00 } /* Keyword.Declaration */
28
+ .kn { color: #cd00cd } /* Keyword.Namespace */
29
+ .kp { color: #cdcd00 } /* Keyword.Pseudo */
30
+ .kr { color: #cdcd00 } /* Keyword.Reserved */
31
+ .kt { color: #00cd00 } /* Keyword.Type */
32
+ .ld { color: #cccccc } /* Literal.Date */
33
+ .m { color: #cd00cd } /* Literal.Number */
34
+ .s { color: #cd0000 } /* Literal.String */
35
+ .na { color: #cccccc } /* Name.Attribute */
36
+ .nb { color: #cd00cd } /* Name.Builtin */
37
+ .nc { color: #00cdcd } /* Name.Class */
38
+ .no { color: #cccccc } /* Name.Constant */
39
+ .nd { color: #cccccc } /* Name.Decorator */
40
+ .ni { color: #cccccc } /* Name.Entity */
41
+ .ne { color: #666699; font-weight: bold } /* Name.Exception */
42
+ .nf { color: #cccccc } /* Name.Function */
43
+ .nl { color: #cccccc } /* Name.Label */
44
+ .nn { color: #cccccc } /* Name.Namespace */
45
+ .nx { color: #cccccc } /* Name.Other */
46
+ .py { color: #cccccc } /* Name.Property */
47
+ .nt { color: #cccccc } /* Name.Tag */
48
+ .nv { color: #00cdcd } /* Name.Variable */
49
+ .ow { color: #cdcd00 } /* Operator.Word */
50
+ .w { color: #cccccc } /* Text.Whitespace */
51
+ .mf { color: #cd00cd } /* Literal.Number.Float */
52
+ .mh { color: #cd00cd } /* Literal.Number.Hex */
53
+ .mi { color: #cd00cd } /* Literal.Number.Integer */
54
+ .mo { color: #cd00cd } /* Literal.Number.Oct */
55
+ .sb { color: #cd0000 } /* Literal.String.Backtick */
56
+ .sc { color: #cd0000 } /* Literal.String.Char */
57
+ .sd { color: #cd0000 } /* Literal.String.Doc */
58
+ .s2 { color: #cd0000 } /* Literal.String.Double */
59
+ .se { color: #cd0000 } /* Literal.String.Escape */
60
+ .sh { color: #cd0000 } /* Literal.String.Heredoc */
61
+ .si { color: #cd0000 } /* Literal.String.Interpol */
62
+ .sx { color: #cd0000 } /* Literal.String.Other */
63
+ .sr { color: #cd0000 } /* Literal.String.Regex */
64
+ .s1 { color: #cd0000 } /* Literal.String.Single */
65
+ .ss { color: #cd0000 } /* Literal.String.Symbol */
66
+ .bp { color: #cd00cd } /* Name.Builtin.Pseudo */
67
+ .vc { color: #00cdcd } /* Name.Variable.Class */
68
+ .vg { color: #00cdcd } /* Name.Variable.Global */
69
+ .vi { color: #00cdcd } /* Name.Variable.Instance */
70
+ .il { color: #cd00cd } /* Literal.Number.Integer.Long */
71
+ }
@@ -0,0 +1,35 @@
1
+ .highlight.vs {
2
+ .hll { background-color: #ffffcc }
3
+ .c { color: #008000 } /* Comment */
4
+ .err { border: 1px solid #FF0000 } /* Error */
5
+ .k { color: #0000ff } /* Keyword */
6
+ .cm { color: #008000 } /* Comment.Multiline */
7
+ .cp { color: #0000ff } /* Comment.Preproc */
8
+ .c1 { color: #008000 } /* Comment.Single */
9
+ .cs { color: #008000 } /* Comment.Special */
10
+ .ge { font-style: italic } /* Generic.Emph */
11
+ .gh { font-weight: bold } /* Generic.Heading */
12
+ .gp { font-weight: bold } /* Generic.Prompt */
13
+ .gs { font-weight: bold } /* Generic.Strong */
14
+ .gu { font-weight: bold } /* Generic.Subheading */
15
+ .kc { color: #0000ff } /* Keyword.Constant */
16
+ .kd { color: #0000ff } /* Keyword.Declaration */
17
+ .kn { color: #0000ff } /* Keyword.Namespace */
18
+ .kp { color: #0000ff } /* Keyword.Pseudo */
19
+ .kr { color: #0000ff } /* Keyword.Reserved */
20
+ .kt { color: #2b91af } /* Keyword.Type */
21
+ .s { color: #a31515 } /* Literal.String */
22
+ .nc { color: #2b91af } /* Name.Class */
23
+ .ow { color: #0000ff } /* Operator.Word */
24
+ .sb { color: #a31515 } /* Literal.String.Backtick */
25
+ .sc { color: #a31515 } /* Literal.String.Char */
26
+ .sd { color: #a31515 } /* Literal.String.Doc */
27
+ .s2 { color: #a31515 } /* Literal.String.Double */
28
+ .se { color: #a31515 } /* Literal.String.Escape */
29
+ .sh { color: #a31515 } /* Literal.String.Heredoc */
30
+ .si { color: #a31515 } /* Literal.String.Interpol */
31
+ .sx { color: #a31515 } /* Literal.String.Other */
32
+ .sr { color: #a31515 } /* Literal.String.Regex */
33
+ .s1 { color: #a31515 } /* Literal.String.Single */
34
+ .ss { color: #a31515 } /* Literal.String.Symbol */
35
+ }
@@ -0,0 +1,74 @@
1
+ .highlight.zenburn {
2
+ color:#fdce93;
3
+ background-color:#3f3f3f;
4
+
5
+ .hll{background-color:#222}
6
+ .c{color:#7f9f7f}
7
+ .err{color:#e37170;background-color:#3d3535}
8
+ .g{color:#7f9f7f}
9
+ .k{color:#f0dfaf}
10
+ .l{color:#ccc}
11
+ .n{color:#dcdccc}
12
+ .o{color:#f0efd0}
13
+ .x{color:#ccc}
14
+ .p{color:#41706f}
15
+ .cm{color:#7f9f7f}
16
+ .cp{color:#7f9f7f}
17
+ .c1{color:#7f9f7f}
18
+ .cs{color:#cd0000;font-weight:bold}
19
+ .gd{color:#cd0000}
20
+ .ge{color:#ccc;font-style:italic}
21
+ .gr{color:red}
22
+ .gh{color:#dcdccc;font-weight:bold}
23
+ .gi{color:#00cd00}
24
+ .go{color:gray}
25
+ .gp{color:#dcdccc;font-weight:bold}
26
+ .gs{color:#ccc;font-weight:bold}
27
+ .gu{color:purple;font-weight:bold}
28
+ .gt{color:#0040D0}
29
+ .kc{color:#dca3a3}
30
+ .kd{color:#ffff86}
31
+ .kn{color:#dfaf8f;font-weight:bold}
32
+ .kp{color:#cdcf99}
33
+ .kr{color:#cdcd00}
34
+ .kt{color:#00cd00}
35
+ .ld{color:#cc9393}
36
+ .m{color:#8cd0d3}
37
+ .s{color:#cc9393}
38
+ .na{color:#9ac39f}
39
+ .nb{color:#efef8f}
40
+ .nc{color:#efef8f}
41
+ .no{color:#ccc}
42
+ .nd{color:#ccc}
43
+ .ni{color:#c28182}
44
+ .ne{color:#c3bf9f;font-weight:bold}
45
+ .nf{color:#efef8f}
46
+ .nl{color:#ccc}
47
+ .nn{color:#8fbede}
48
+ .nx{color:#ccc}
49
+ .py{color:#ccc}
50
+ .nt{color:#9ac39f}
51
+ .nv{color:#dcdccc}
52
+ .ow{color:#f0efd0}
53
+ .w{color:#ccc}
54
+ .mf{color:#8cd0d3}
55
+ .mh{color:#8cd0d3}
56
+ .mi{color:#8cd0d3}
57
+ .mo{color:#8cd0d3}
58
+ .sb{color:#cc9393}
59
+ .sc{color:#cc9393}
60
+ .sd{color:#cc9393}
61
+ .s2{color:#cc9393}
62
+ .se{color:#cc9393}
63
+ .sh{color:#cc9393}
64
+ .si{color:#cc9393}
65
+ .sx{color:#cc9393}
66
+ .sr{color:#cc9393}
67
+ .s1{color:#cc9393}
68
+ .ss{color:#cc9393}
69
+ .bp{color:#efef8f}
70
+ .vc{color:#efef8f}
71
+ .vg{color:#dcdccc}
72
+ .vi{color:#ffffc7}
73
+ .il{color:#8cd0d3}
74
+ }
@@ -0,0 +1 @@
1
+ @import "rouge/colorschemes";
@@ -0,0 +1,5 @@
1
+ module RougeHelper
2
+ def code_sample(name, language)
3
+ render(partial: name, locals: { language: language })
4
+ end
5
+ end
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rouge/rails"
5
+
6
+ require "pry"
7
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,17 @@
1
+ module Rouge::Rails
2
+ class Configuration
3
+ attr_accessor :default_colorscheme
4
+
5
+ def initialize
6
+ @default_colorscheme = :default
7
+ end
8
+ end
9
+
10
+ def self.configure
11
+ yield configuration
12
+ end
13
+
14
+ def self.configuration
15
+ @config ||= Rouge::Rails::Configuration.new
16
+ end
17
+ end
@@ -0,0 +1,4 @@
1
+ module Rouge::Rails
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,10 @@
1
+ module Rouge::Rails
2
+ class Railtie < ::Rails::Railtie
3
+ initializer "rouge.rails.register_template_handler" do
4
+ ActionView::Template.register_template_handler(
5
+ :rouge,
6
+ Rouge::Rails::TemplateHandler
7
+ )
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,45 @@
1
+ module Rouge::Rails
2
+ class TemplateHandler
3
+ def self.call(template)
4
+ new(template).call
5
+ end
6
+
7
+ attr_accessor :template
8
+
9
+ def initialize(template)
10
+ @template = template
11
+ end
12
+
13
+ def call
14
+ %{
15
+ lexer = #{lexer}
16
+ formatter = Rouge::Formatters::HTML.new(css_class: "#{colorscheme}")
17
+ formatter.format(lexer.lex(#{source})).html_safe
18
+ }
19
+ end
20
+
21
+ def lexer
22
+ if template.locals.include?("language")
23
+ "Rouge::Lexer.find(language) || #{default_lexer}"
24
+ else
25
+ default_lexer
26
+ end
27
+ end
28
+
29
+ def colorscheme
30
+ if template.locals.include?("colorscheme")
31
+ "highlight \#{colorscheme}"
32
+ else
33
+ "highlight #{Rouge::Rails.configuration.default_colorscheme}"
34
+ end
35
+ end
36
+
37
+ def source
38
+ template.source.inspect
39
+ end
40
+
41
+ def default_lexer
42
+ "Rouge::Lexers::PlainText"
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,5 @@
1
+ module Rouge
2
+ module Rails
3
+ VERSION = "0.1.1"
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ require "rails/railtie"
2
+ require "rails/engine"
3
+ require "action_view"
4
+ require "rouge"
5
+
6
+ require "rouge/rails/version"
7
+ require "rouge/rails/template_handler"
8
+ require "rouge/rails/railtie"
9
+ require "rouge/rails/configuration"
10
+ require "rouge/rails/engine"
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "rouge/rails/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rouge-rails"
8
+ spec.version = Rouge::Rails::VERSION
9
+ spec.authors = ["Jacob Morris"]
10
+ spec.email = ["jacob.s.morris@gmail.com"]
11
+
12
+ spec.summary = %q{Simple template handler for rouge code samples}
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency "rouge"
21
+ spec.add_runtime_dependency "railties"
22
+ spec.add_runtime_dependency "actionview"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.11"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ spec.add_development_dependency "pry"
28
+ end
metadata ADDED
@@ -0,0 +1,183 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rouge-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Jacob Morris
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-02-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rouge
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: railties
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: actionview
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.11'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.11'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description:
112
+ email:
113
+ - jacob.s.morris@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".travis.yml"
121
+ - Gemfile
122
+ - LICENSE.txt
123
+ - README.md
124
+ - Rakefile
125
+ - app/assets/stylesheets/rouge.scss
126
+ - app/assets/stylesheets/rouge/autumn.scss
127
+ - app/assets/stylesheets/rouge/borland.scss
128
+ - app/assets/stylesheets/rouge/bw.scss
129
+ - app/assets/stylesheets/rouge/colorful.scss
130
+ - app/assets/stylesheets/rouge/colorschemes.scss
131
+ - app/assets/stylesheets/rouge/default.scss
132
+ - app/assets/stylesheets/rouge/emacs.scss
133
+ - app/assets/stylesheets/rouge/friendly.scss
134
+ - app/assets/stylesheets/rouge/fruity.scss
135
+ - app/assets/stylesheets/rouge/github.scss
136
+ - app/assets/stylesheets/rouge/manni.scss
137
+ - app/assets/stylesheets/rouge/monokai.scss
138
+ - app/assets/stylesheets/rouge/murphy.scss
139
+ - app/assets/stylesheets/rouge/native.scss
140
+ - app/assets/stylesheets/rouge/pastie.scss
141
+ - app/assets/stylesheets/rouge/perldoc.scss
142
+ - app/assets/stylesheets/rouge/solarized-dark.scss
143
+ - app/assets/stylesheets/rouge/solarized-light.scss
144
+ - app/assets/stylesheets/rouge/tango.scss
145
+ - app/assets/stylesheets/rouge/trac.scss
146
+ - app/assets/stylesheets/rouge/vim.scss
147
+ - app/assets/stylesheets/rouge/vs.scss
148
+ - app/assets/stylesheets/rouge/zenburn.scss
149
+ - app/helpers/rouge_helper.rb
150
+ - bin/console
151
+ - bin/setup
152
+ - lib/rouge/rails.rb
153
+ - lib/rouge/rails/configuration.rb
154
+ - lib/rouge/rails/engine.rb
155
+ - lib/rouge/rails/railtie.rb
156
+ - lib/rouge/rails/template_handler.rb
157
+ - lib/rouge/rails/version.rb
158
+ - rouge-rails.gemspec
159
+ homepage:
160
+ licenses:
161
+ - MIT
162
+ metadata: {}
163
+ post_install_message:
164
+ rdoc_options: []
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ requirements: []
178
+ rubyforge_project:
179
+ rubygems_version: 2.5.1
180
+ signing_key:
181
+ specification_version: 4
182
+ summary: Simple template handler for rouge code samples
183
+ test_files: []