Compare commits

..

12 Commits

Author SHA1 Message Date
bootstraponline 86eda9bb10 Release 2.4.4 2012-11-30 17:28:53 -07:00
bootstraponline ca06aa9a6f Merge pull request #595 from jtietema/patch-1
Update lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js
2012-11-30 16:11:47 -08:00
Jeroen Tietema ca57d9e83d Update lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js
Adjusted the height of the preview window so that it doesn't flow 
offscreen. (It was impossible to read the last lines...)
2012-11-30 22:20:36 +01:00
bootstraponline 904f975f0c Fix comment 2012-11-30 00:02:24 -07:00
bootstraponline 9b9212cf4c Remove needless conversion
The fix for page.rb resolved UTF-8 in headers.
2012-11-30 00:00:28 -07:00
bootstraponline 404419d1c3 Release 2.4.3 2012-11-29 23:57:15 -07:00
bootstraponline 4ee94a6574 Fix UTF-8 header and add test 2012-11-29 23:47:25 -07:00
bootstraponline f929df0419 Update check_h1 2012-11-29 23:04:40 -07:00
bootstraponline 57587dafbe Fix UTF-8 in headers 2012-11-29 22:05:29 -07:00
bootstraponline 31a95e81b3 Fix test name 2012-11-29 21:36:04 -07:00
bootstraponline 70a4e9551b Improve h1 test 2012-11-29 21:27:45 -07:00
bootstraponline e1a705f975 Fix UTF-8
to_html uses source document encoding by default. Set UTF-8.

Add note about KCODE warning.
2012-11-29 20:05:41 -07:00
6 changed files with 47 additions and 8 deletions
+2 -2
View File
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
s.required_ruby_version = ">= 1.8.7"
s.name = 'gollum'
s.version = '2.4.2'
s.date = '2012-11-29'
s.version = '2.4.4'
s.date = '2012-11-30'
s.rubyforge_project = 'gollum'
s.summary = "A simple, Git-powered wiki."
+3 -1
View File
@@ -24,10 +24,12 @@ require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
# Set ruby to UTF-8 mode
# Do not remove because of warning.
# This is required for Ruby 1.8.7 which gollum still supports.
$KCODE = 'U'
module Gollum
VERSION = '2.4.2'
VERSION = '2.4.4'
def self.assets_path
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
@@ -464,7 +464,7 @@ var applyTimeout = function () {
// width -2 for scroll bar & -10 for left offset
var previewStyle = 'width:' + (widthHalf - 2 - 10) + 'px;' +
'height:' + height + 'px;' +
'height:' + (height -50) + 'px;' +
'left:' + (leftRight === false ? '10px;' : widthHalf + 'px;') +
// preview panel top is equal to height of comment tool panel (40px) + 1
'top:41px;';
+4 -3
View File
@@ -109,7 +109,7 @@ module Precious
# Wraps page formatted data to Nokogiri::HTML document.
#
def build_document(content)
Nokogiri::HTML(%{<div id="gollum-root">} + content + %{</div>})
Nokogiri::HTML::fragment(%{<div id="gollum-root">} + content.to_s + %{</div>}, 'UTF-8')
end
# Finds header node inside Nokogiri::HTML document.
@@ -134,7 +134,7 @@ module Precious
def page_header_from_content(content)
doc = build_document(content)
title = find_header_node(doc)
Sanitize.clean(title.to_html).strip unless title.empty?
Sanitize.clean(title.to_xhtml(:encoding => 'UTF-8')).strip unless title.empty?
end
# Returns page content without title if it was extracted.
@@ -143,7 +143,8 @@ module Precious
doc = build_document(content)
title = find_header_node(doc)
title.remove unless title.empty?
doc.css("div#gollum-root").inner_html
# .inner_html will cause href escaping on UTF-8
doc.css("div#gollum-root").children.to_xhtml(:encoding => 'UTF-8')
end
end
end
+15 -1
View File
@@ -38,10 +38,24 @@ context "Frontend" do
assert_equal 'm-plus-f', 'μ†ℱ'.to_url
end
test 'utf-8 kcode' do
test "utf-8 kcode" do
assert_equal 'μ†ℱ'.scan(/./), ["μ", "", ""]
end
test "UTF-8 headers href preserved" do
page = 'utfh1'
text = '한글'
# don't use h1 or it will be promoted to replace file name
# which doesn't generate a normal header link
@wiki.write_page(page, :markdown, '## ' + text,
{ :name => 'user1', :email => 'user1' });
get page
assert_match /<h2>#{text}<a class="anchor" id="#{text}" href="##{text}"><\/a><\/h2>/, last_response.body
end
test "retain edit information" do
page1 = 'page1'
user1 = 'user1'
+22
View File
@@ -41,6 +41,28 @@ context "Unicode Support" do
assert_equal '', anchors[0].text
end
def check_h1 text, page
@wiki.write_page(page, :markdown, "# " + text)
page = @wiki.page(page)
assert_equal Gollum::Page, page.class
assert_equal '# ' + text, utf8(page.raw_data)
output = page.formatted_data
# UTF-8 headers should not be encoded.
assert_match /<h1>#{text}<a class="anchor" id="#{text}" href="##{text}"><\/a><\/h1>/, output
end
test "create and read non-latin page with anchor" do
# href="#한글"
# href="#%ED%95%9C%EA%B8%80"
check_h1 '한글', '1'
# href="#Synhtèse"
# href="#Synht%C3%A8se"
check_h1 'Synhtèse', '2'
end
test "create and read non-latin page with anchor 2" do
@wiki.write_page("test", :markdown, "# \"La\" faune d'Édiacara")