[DRE-commits] [ruby-org] 53/303: Fixed regression in smart quotes.

Jérémy Bobbio lunar at alioth.debian.org
Fri Aug 9 17:33:26 UTC 2013


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository ruby-org.

commit 23db402a640bc7329cf53308cfc45415b268956a
Author: Brian Dewey <bdewey at gmail.com>
Date:   Tue Dec 29 07:59:27 2009 -0800

    Fixed regression in smart quotes.
---
 History.txt                        |    6 ++++++
 lib/org-ruby/html_output_buffer.rb |    5 +++--
 spec/html_examples/block_code.html |    2 +-
 spec/html_examples/entities.html   |    3 +++
 spec/html_examples/entities.org    |    8 ++++++++
 5 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/History.txt b/History.txt
index de20948..8a7eb58 100644
--- a/History.txt
+++ b/History.txt
@@ -1,3 +1,9 @@
+== X.X.X / 2009-12-29
+
+* Fixed bugs:
+  * Regressed smart double quotes with HTML escaping. Added a test
+    case and fixed the regression.
+
 == 0.4.1 / 2009-12-29
 
 * HTML is now escaped by default
diff --git a/lib/org-ruby/html_output_buffer.rb b/lib/org-ruby/html_output_buffer.rb
index 1caca78..12b3053 100644
--- a/lib/org-ruby/html_output_buffer.rb
+++ b/lib/org-ruby/html_output_buffer.rb
@@ -1,5 +1,4 @@
 require OrgRuby.libpath(*%w[org-ruby output_buffer])
-require 'cgi'
 
 module Orgmode
 
@@ -77,7 +76,9 @@ module Orgmode
 
     # Escapes any HTML content in the output accumulation buffer @buffer.
     def escape_buffer!
-      @buffer = CGI.escapeHTML(@buffer)
+      @buffer.gsub!(/&/, "&")
+      @buffer.gsub!(/</, "<")
+      @buffer.gsub!(/>/, ">")
     end
 
     def output_indentation
diff --git a/spec/html_examples/block_code.html b/spec/html_examples/block_code.html
index 0f96479..0f94686 100644
--- a/spec/html_examples/block_code.html
+++ b/spec/html_examples/block_code.html
@@ -5,7 +5,7 @@
 
     def initialize(output)
       @output = output
-      @buffer = ""
+      @buffer = ""
       @output_type = :start
       @list_indent_stack = []
       @paragraph_modifier = nil
diff --git a/spec/html_examples/entities.html b/spec/html_examples/entities.html
new file mode 100644
index 0000000..cc33c69
--- /dev/null
+++ b/spec/html_examples/entities.html
@@ -0,0 +1,3 @@
+<p class="title">ENTITIES</p>
+<p><code>Org-ruby</code> supports “smart double quotes,” ‘smart single quotes,’ apostrophes for contractions like won’t and can’t, and other things… like elipses. Oh – and dashes.</p>
+<p>Question: What does org-mode do for ampersands, like R&R? or &lt;? Answer: Those get escaped, too.</p>
diff --git a/spec/html_examples/entities.org b/spec/html_examples/entities.org
new file mode 100644
index 0000000..77ecf60
--- /dev/null
+++ b/spec/html_examples/entities.org
@@ -0,0 +1,8 @@
+ENTITIES
+
+=Org-ruby= supports "smart double quotes," 'smart single quotes,'
+apostrophes for contractions like won't and can't, and other
+things... like elipses. Oh -- and dashes.
+
+Question: What does org-mode do for ampersands, like R&R? or <?
+Answer: Those get escaped, too.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-org.git



More information about the Pkg-ruby-extras-commits mailing list