From a657b12a881358efb5513aa754eafc5601617ab2 Mon Sep 17 00:00:00 2001 From: rick Date: Tue, 7 Dec 2010 15:29:25 -0800 Subject: [PATCH] revert last commit due to parsing issues --- HISTORY.md | 1 - lib/gollum/markup.rb | 37 ------------------------------------- test/test_markup.rb | 10 ---------- 3 files changed, 48 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index fb585a03..6938de58 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -9,7 +9,6 @@ rendering for added customization. * Bug Fixes * Use `@wiki.page_class` in Gollum::Markup where appropriate (#63). - * Don't modify content inside
 tags during rendering.
 
 # 1.1.0 / 2010-10-28
 
diff --git a/lib/gollum/markup.rb b/lib/gollum/markup.rb
index 00fb1d91..6b8a4582 100644
--- a/lib/gollum/markup.rb
+++ b/lib/gollum/markup.rb
@@ -33,7 +33,6 @@ module Gollum
         @wiki.sanitizer
 
       data = extract_tex(@data.dup)
-      data = extract_pre(data)
       data = extract_code(data)
       data = extract_tags(data)
       begin
@@ -46,7 +45,6 @@ module Gollum
       end
       data = process_tags(data)
       data = process_code(data)
-      data = process_pre(data)
       if sanitize || block_given?
         doc  = Nokogiri::HTML::DocumentFragment.parse(data)
         doc  = sanitize.clean_node!(doc) if sanitize
@@ -413,40 +411,5 @@ module Gollum
     # Returns nothing.
     def update_cache(type, id, data)
     end
-
-    #########################################################################
-    #
-    # Code
-    #
-    #########################################################################
-
-    # Extract all code blocks into the codemap and replace with placeholders.
-    #
-    # data - The raw String data.
-    #
-    # Returns the placeholder'd String data.
-    def extract_pre(data)
-      data.gsub! /\r/, '' # \r gets encoded to 
-      doc = Nokogiri::HTML::DocumentFragment.parse(data)
-      doc.search('pre').each do |element|
-        id = Digest::SHA1.hexdigest(element.inner_html)
-        @premap[id] = element.inner_html
-        element.inner_html = id
-      end
-      doc_to_html(doc)
-    end
-
-    # Process all code from the codemap and replace the placeholders with the
-    # final HTML.
-    #
-    # data - The String data (with placeholders).
-    #
-    # Returns the marked up String data.
-    def process_pre(data)
-      @premap.each do |id, content|
-        data.gsub!(id, content)
-      end
-      data
-    end
   end
 end
diff --git a/test/test_markup.rb b/test/test_markup.rb
index 33739cf7..892685af 100644
--- a/test/test_markup.rb
+++ b/test/test_markup.rb
@@ -50,16 +50,6 @@ context "Markup" do
     assert yielded
   end
 
-  test "does not modify content in pre tags" do
-    @wiki.write_page("Pre", :markdown, 
-      "abc [[a]]\n\n
 [[b]] 
\n\n``` ruby\n[[c]]\n```\n[[d]]", - commit_details) - page = @wiki.page("Pre") - html = page.formatted_data - assert html['[[b]]'] - assert html[%([[c)] - end - ######################################################################### # # Links