diff --git a/spec/visual/app.rb b/spec/visual/app.rb index 128d198e47..71070c3ca6 100644 --- a/spec/visual/app.rb +++ b/spec/visual/app.rb @@ -40,6 +40,7 @@ def query_string theme_class = Rouge::Theme.find(params[:theme] || 'thankful_eyes') halt 404 unless theme_class @theme = theme_class.new(scope: '.codehilite') + @comment_color = @theme.class.get_style(Rouge::Token::Tokens::Comment).fg formatter_opts = { :line_numbers => params[:line_numbers] } formatter_opts[:inline_theme] = @theme if params[:inline] @@ -53,6 +54,7 @@ def query_string @sample = File.read(SAMPLES.join(@lexer.class.tag), encoding: 'utf-8') @title = "#{@lexer.class.tag} | Visual Test" + @raw = Rouge.highlight(@sample, 'plaintext', @formatter) @highlighted = Rouge.highlight(@sample, @lexer, @formatter) erb :lexer diff --git a/spec/visual/templates/index.erb b/spec/visual/templates/index.erb index 9c20a34ac4..6df2ef4fcf 100644 --- a/spec/visual/templates/index.erb +++ b/spec/visual/templates/index.erb @@ -1,20 +1,32 @@ -

Lexers supported by Rouge v<%= Rouge.version %>

- -<% @samples.each do |sample| %> -
-

<%= sample.tag %>

-<%= Rouge.highlight(sample.demo, sample, @formatter) %> -
-<% end %> + +
+ <% @samples.each do |sample| %> +
+
+

<%= sample.tag %>

+
+ <%= Rouge.highlight(sample.demo, sample, @formatter) %> +
+ <% end %> +
diff --git a/spec/visual/templates/layout.erb b/spec/visual/templates/layout.erb index 51217ef454..6744c76e4d 100644 --- a/spec/visual/templates/layout.erb +++ b/spec/visual/templates/layout.erb @@ -2,12 +2,14 @@ <%= @title %> - <%= yield %> + - - diff --git a/spec/visual/templates/lexer.erb b/spec/visual/templates/lexer.erb index 52f0955491..be00d16410 100644 --- a/spec/visual/templates/lexer.erb +++ b/spec/visual/templates/lexer.erb @@ -1,21 +1,35 @@ -
-

Legend

-
<%
-    Rouge::Token.each_token do |token|
-      %><%= token.qualname %>
-<%      end
-  %>
-
-

Highlighted

-<%= @highlighted %> + +
+

Highlighted

+ <%= @highlighted %> + +

Raw

+
<%= @raw %>
+
-

Raw

-
<%= CGI.escape_html(@sample) %>
+