File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 5
5
6
6
module Jekyll
7
7
class CodeMirror < Liquid ::Block
8
+
8
9
def initialize ( tag_name , lang , tokens )
9
10
super
10
11
@lang = lang . to_s . strip
11
12
end
12
13
13
14
def render ( context )
14
15
require 'cgi'
15
- '<pre class="codemirror" data-lang="' + @lang . to_s + '">' + CGI . escapeHTML ( super . strip ) + '</pre >'
16
+ '<textarea class="codemirror" data-lang="' + @lang . to_s + '">' + CGI . escapeHTML ( super . strip ) + '</textarea >'
16
17
end
17
18
end
18
19
end
Original file line number Diff line number Diff line change @@ -38,8 +38,10 @@ def write(dest)
38
38
# If the file is HTML, newlines within <pre> elements should not be
39
39
# collapsed.
40
40
pre_regexp = /<\/ ?pre[^>]*>/i
41
- pre_list = output . scan ( pre_regexp )
42
- blocks = output . split ( pre_regexp )
41
+ textarea_regexp = /<\/ ?textarea[^>]*>/i
42
+
43
+ pre_list = output . scan ( Regexp . union ( pre_regexp , textarea_regexp ) )
44
+ blocks = output . split ( Regexp . union ( pre_regexp , textarea_regexp ) )
43
45
44
46
collapsed_blocks = [ ]
45
47
blocks . each_with_index do |block , i |
You can’t perform that action at this time.
0 commit comments