Skip to content
This repository has been archived by the owner on Jun 24, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: code blocks with unknown languages
should have same markup as code blocks with known languages
  • Loading branch information
Christian Kruse committed Jan 14, 2016
1 parent d9564f8 commit 5b94b6b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/cf_kramdown.rb
Expand Up @@ -96,6 +96,7 @@ def conf(name)
def convert_codeblock(el, indent)
ret = super(el, indent)
ret.gsub!(/<div class="highlighter-rouge"><pre class="highlight"><code>\n?(.*)<\/code><\/pre>\n<\/div>/m, '<code class="block">\1</code>')
ret.gsub!(/<pre><code class="[^"]+">\n?(.*)<\/code><\/pre>/m, '<code class="block">\1</code>')

ret
end
Expand Down
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-

require "rails_helper"

RSpec.describe "problematic site is in preview" do
let(:message) { create(:cf_message, content: "~~~brainfuck
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
~~~") }

include CForum::Tools

it "has no problematic site when value is empty" do
visit cf_message_path(message.thread, message)
expect(page.find(".posting-content")).to have_css("code.block")
end
end

# eof

0 comments on commit 5b94b6b

Please sign in to comment.