rouge 1.10.1 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rouge/cli.rb +1 -1
- data/lib/rouge/demos/actionscript +4 -0
- data/lib/rouge/demos/apiblueprint +33 -0
- data/lib/rouge/demos/biml +38 -0
- data/lib/rouge/demos/ceylon +7 -0
- data/lib/rouge/demos/cmake +7 -0
- data/lib/rouge/demos/coq +11 -0
- data/lib/rouge/demos/d +16 -0
- data/lib/rouge/demos/eiffel +30 -0
- data/lib/rouge/demos/fortran +22 -0
- data/lib/rouge/demos/gradle +10 -0
- data/lib/rouge/demos/jinja +9 -0
- data/lib/rouge/demos/jsonnet +28 -0
- data/lib/rouge/demos/julia +11 -0
- data/lib/rouge/demos/nasm +26 -0
- data/lib/rouge/demos/objective_c +4 -0
- data/lib/rouge/demos/protobuf +5 -0
- data/lib/rouge/demos/shell_session +10 -0
- data/lib/rouge/demos/smarty +12 -0
- data/lib/rouge/demos/tap +5 -0
- data/lib/rouge/demos/twig +9 -0
- data/lib/rouge/demos/typescript +1 -0
- data/lib/rouge/demos/verilog +27 -0
- data/lib/rouge/demos/viml +14 -5
- data/lib/rouge/formatters/html_wrapper.rb +11 -0
- data/lib/rouge/formatters/terminal256.rb +1 -1
- data/lib/rouge/lexer.rb +4 -2
- data/lib/rouge/lexers/actionscript.rb +195 -0
- data/lib/rouge/lexers/apache.rb +23 -20
- data/lib/rouge/lexers/apache/keywords.yml +721 -410
- data/lib/rouge/lexers/apiblueprint.rb +51 -0
- data/lib/rouge/lexers/biml.rb +41 -0
- data/lib/rouge/lexers/c.rb +7 -2
- data/lib/rouge/lexers/ceylon.rb +123 -0
- data/lib/rouge/lexers/clojure.rb +1 -1
- data/lib/rouge/lexers/cmake.rb +206 -0
- data/lib/rouge/lexers/coffeescript.rb +1 -1
- data/lib/rouge/lexers/coq.rb +187 -0
- data/lib/rouge/lexers/cpp.rb +12 -1
- data/lib/rouge/lexers/csharp.rb +12 -5
- data/lib/rouge/lexers/css.rb +2 -0
- data/lib/rouge/lexers/d.rb +176 -0
- data/lib/rouge/lexers/diff.rb +9 -9
- data/lib/rouge/lexers/eiffel.rb +65 -0
- data/lib/rouge/lexers/fortran.rb +142 -0
- data/lib/rouge/lexers/gradle.rb +37 -0
- data/lib/rouge/lexers/groovy.rb +2 -2
- data/lib/rouge/lexers/ini.rb +2 -2
- data/lib/rouge/lexers/java.rb +11 -8
- data/lib/rouge/lexers/javascript.rb +2 -1
- data/lib/rouge/lexers/jinja.rb +137 -0
- data/lib/rouge/lexers/jsonnet.rb +151 -0
- data/lib/rouge/lexers/julia.rb +172 -0
- data/lib/rouge/lexers/markdown.rb +1 -0
- data/lib/rouge/lexers/nasm.rb +203 -0
- data/lib/rouge/lexers/objective_c.rb +11 -0
- data/lib/rouge/lexers/php.rb +1 -1
- data/lib/rouge/lexers/powershell.rb +1 -1
- data/lib/rouge/lexers/protobuf.rb +70 -0
- data/lib/rouge/lexers/python.rb +23 -0
- data/lib/rouge/lexers/r.rb +53 -20
- data/lib/rouge/lexers/ruby.rb +4 -4
- data/lib/rouge/lexers/rust.rb +2 -2
- data/lib/rouge/lexers/shell_session.rb +29 -0
- data/lib/rouge/lexers/smarty.rb +91 -0
- data/lib/rouge/lexers/sql.rb +1 -1
- data/lib/rouge/lexers/swift.rb +20 -5
- data/lib/rouge/lexers/tap.rb +91 -0
- data/lib/rouge/lexers/twig.rb +37 -0
- data/lib/rouge/lexers/typescript.rb +46 -0
- data/lib/rouge/lexers/verilog.rb +164 -0
- data/lib/rouge/regex_lexer.rb +1 -1
- data/lib/rouge/version.rb +1 -1
- data/rouge.gemspec +1 -1
- metadata +47 -6
- data/lib/rouge/formatters/html_inline.rb +0 -20
- data/lib/rouge/formatters/html_linewise.rb +0 -31
@@ -1,20 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*- #
|
2
|
-
|
3
|
-
module Rouge
|
4
|
-
module Formatters
|
5
|
-
class HTMLInline < HTML
|
6
|
-
def initialize(theme)
|
7
|
-
@theme = theme
|
8
|
-
end
|
9
|
-
|
10
|
-
def safe_span(tok, safe_val)
|
11
|
-
return safe_val if tok == Token::Tokens::Text
|
12
|
-
|
13
|
-
rules = @inline_theme.style_for(tok).rendered_rules
|
14
|
-
|
15
|
-
"<span style=\"#{rules.to_a.join(';')}\">#{safe_val}</span>"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*- #
|
2
|
-
|
3
|
-
module Rouge
|
4
|
-
module Formatters
|
5
|
-
class HTMLLinewise < Formatter
|
6
|
-
def initialize(formatter, opts={})
|
7
|
-
@formatter = formatter
|
8
|
-
@class_format = opts.fetch(:class, '%i')
|
9
|
-
end
|
10
|
-
|
11
|
-
def stream(tokens, &b)
|
12
|
-
yield "<span class=#{next_line_class}>"
|
13
|
-
tokens.each do |tok, val|
|
14
|
-
val.scan /\n|[^\n]+/ do |s|
|
15
|
-
if s == "\n"
|
16
|
-
yield "</span>\n<span class=#{next_line_class}>"
|
17
|
-
else
|
18
|
-
@formatter.span(tok, s)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
yield "</span>"
|
23
|
-
end
|
24
|
-
|
25
|
-
def next_line_class
|
26
|
-
@lineno ||= -1
|
27
|
-
sprintf(@class_format, @lineno += 1).inspect
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|