Skip to content

Commit

Permalink
fix: syntax language parsing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jlong committed Jul 25, 2011
1 parent d3a34c7 commit a60338f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions examples/views/index.erb
Expand Up @@ -47,4 +47,20 @@ create table exams (
result integer default 0 collate nocase,
when datetime
);
</pre>

<h3>html</h3>

<pre>:::html
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Hello!&lt;/title&gt;
&lt;style type="text/css"&gt;
h1 { color: blue; }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Hello World&lt;/h1&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
2 changes: 1 addition & 1 deletion lib/rack/codehighlighter.rb
Expand Up @@ -91,7 +91,7 @@ def syntax(string)
refs = @opts[:pattern].match(string) # extract language name
if refs
lang = refs[1]
convertor = ::Syntax::Convertors::HTML.for_syntax translate[lang]
convertor = ::Syntax::Convertors::HTML.for_syntax translate[lang] || lang
convertor.convert(unescape_html(string.sub(@opts[:pattern], "")) || "[=this can'n happen=]")
else
"<pre>#{string}</pre>"
Expand Down

0 comments on commit a60338f

Please sign in to comment.