Fix nokogiri rendering

https://github.com/sparklemotion/nokogiri/issues/782
This commit is contained in:
bootstraponline
2012-10-27 18:22:43 -06:00
parent 68465a8651
commit 776df4e6ee
17 changed files with 39 additions and 24 deletions
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
# stdlib
require 'digest/md5'
require 'ostruct'
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Gollum
class BlobEntry
# Gets the String SHA for this blob.
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Gollum
# Responsible for handling the commit process for a Wiki. It sets up the
# Git index, provides methods for modifying the tree, and stores callbacks
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Gollum
class File
Wiki.file_class = self
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Gollum
=begin
FileView requires that:
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
require 'cgi'
require 'sinatra'
require 'gollum'
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Precious
module Helpers
# Extract the path string that Gollum::Wiki expects
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Gollum
# Controls all access to the Git objects from Gollum. Extend this class to
# add custom caching for special cases.
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
require 'net/http'
require 'net/https' # ruby 1.8.7 fix, remove at upgrade
require 'uri'
+6 -7
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
require 'digest/sha1'
require 'cgi'
require 'pygments'
@@ -74,13 +75,11 @@ module Gollum
doc,toc = process_headers(doc)
@toc = @sub_page ? ( @parent_page ? @parent_page.toc_data : "[[_TOC_]]" ) : toc
yield doc if block_given?
data = doc.to_xhtml(:indent => 0, :encoding => 'UTF-8')
# fix 4 space indented code blocks introduced by nokogiri.
# tag should not have a newline after it
data.gsub!(/<pre>\s*<code>(.+)<\/code>\s*<\/pre>/m) do
"<pre><code>#{$1}</code></pre>"
end
# nokogiri's save options are xored together. FORMAT has a value of 1 so ^ 1 removes it.
# formatting will create extra spaces in pre tags.
# https://github.com/sparklemotion/nokogiri/issues/782
# DEFAULT_HTML encodes unicode so XHTML is used for proper unicode support in href.
data = doc.to_xml( { :save_with => Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML ^ 1, :indent => 0, :encoding => 'UTF-8' } )
data = process_toc_tags(data)
data = process_wsd(data)
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Gollum
class Page
include Pagination
+2 -1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Gollum
module Pagination
def self.included(klass)
@@ -58,4 +59,4 @@ module Gollum
self.class.log_pagination_options(options)
end
end
end
end
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Gollum
# Encapsulate sanitization options.
#
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
require 'net/http'
require 'uri'
require 'open-uri'
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Gollum
class Wiki
include Pagination