gollum 2.4.2 → 2.4.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gollum might be problematic. Click here for more details.
- data/gollum.gemspec +1 -1
- data/lib/gollum.rb +3 -1
- data/lib/gollum/frontend/views/page.rb +4 -3
- data/lib/gollum/markup.rb +5 -1
- metadata +1 -1
data/gollum.gemspec
CHANGED
data/lib/gollum.rb
CHANGED
@@ -24,10 +24,12 @@ require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
|
|
24
24
|
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
|
25
25
|
|
26
26
|
# Set ruby to UTF-8 mode
|
27
|
+
# Do not remove because of warning.
|
28
|
+
# This is required for Ruby 1.8.7 which gollum still supports.
|
27
29
|
$KCODE = 'U'
|
28
30
|
|
29
31
|
module Gollum
|
30
|
-
VERSION = '2.4.
|
32
|
+
VERSION = '2.4.3'
|
31
33
|
|
32
34
|
def self.assets_path
|
33
35
|
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
|
@@ -109,7 +109,7 @@ module Precious
|
|
109
109
|
# Wraps page formatted data to Nokogiri::HTML document.
|
110
110
|
#
|
111
111
|
def build_document(content)
|
112
|
-
Nokogiri::HTML(%{<div id="gollum-root">} + content + %{</div>})
|
112
|
+
Nokogiri::HTML::fragment(%{<div id="gollum-root">} + content.to_s + %{</div>}, 'UTF-8')
|
113
113
|
end
|
114
114
|
|
115
115
|
# Finds header node inside Nokogiri::HTML document.
|
@@ -134,7 +134,7 @@ module Precious
|
|
134
134
|
def page_header_from_content(content)
|
135
135
|
doc = build_document(content)
|
136
136
|
title = find_header_node(doc)
|
137
|
-
Sanitize.clean(title.
|
137
|
+
Sanitize.clean(title.to_xhtml(:encoding => 'UTF-8')).strip unless title.empty?
|
138
138
|
end
|
139
139
|
|
140
140
|
# Returns page content without title if it was extracted.
|
@@ -143,7 +143,8 @@ module Precious
|
|
143
143
|
doc = build_document(content)
|
144
144
|
title = find_header_node(doc)
|
145
145
|
title.remove unless title.empty?
|
146
|
-
|
146
|
+
# .inner_html will cause href escaping on UTF-8
|
147
|
+
doc.css("div#gollum-root").children.to_xhtml(:encoding => 'UTF-8')
|
147
148
|
end
|
148
149
|
end
|
149
150
|
end
|
data/lib/gollum/markup.rb
CHANGED
@@ -126,7 +126,11 @@ module Gollum
|
|
126
126
|
node.add_child(%Q{<a href="##{h_name}">#{h.content}</a>})
|
127
127
|
tail.add_child(node)
|
128
128
|
end
|
129
|
-
|
129
|
+
if toc != nil
|
130
|
+
# convert to HTML first before XHTML
|
131
|
+
toc = Nokogiri::HTML::fragment toc.to_s
|
132
|
+
toc = toc.to_xhtml(:encoding => 'UTF-8')
|
133
|
+
end
|
130
134
|
[doc, toc]
|
131
135
|
end
|
132
136
|
|