[DRE-commits] [ruby-org] 50/303: Fixed bug: HTML literals are now escaped in org text, at least in HTML output. I haven't tested this in textile.
Jérémy Bobbio
lunar at alioth.debian.org
Fri Aug 9 17:33:25 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 6ceb3c1035bb5c8c51a876ce6b6223f7b2225678
Author: Brian Dewey <bdewey at gmail.com>
Date: Tue Dec 29 00:46:30 2009 -0800
Fixed bug: HTML literals are now escaped in org text, at least in HTML output. I haven't tested this in textile.
---
History.txt | 4 ++++
lib/org-ruby.rb | 2 +-
lib/org-ruby/html_output_buffer.rb | 8 +++++++-
spec/html_examples/html-literal.html | 2 ++
spec/html_examples/html-literal.org | 6 ++++++
5 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/History.txt b/History.txt
index 6fb6aa1..472461c 100644
--- a/History.txt
+++ b/History.txt
@@ -1,3 +1,7 @@
+== 0.4.1 / 2009-12-29
+
+* HTML is now escaped by default.
+
== 0.4.0 / 2009-12-28
* The first thing output in HTML gets the class "title"
diff --git a/lib/org-ruby.rb b/lib/org-ruby.rb
index 139a7cf..63cb2e4 100644
--- a/lib/org-ruby.rb
+++ b/lib/org-ruby.rb
@@ -3,7 +3,7 @@ unless defined? ::OrgRuby
module OrgRuby
# :stopdoc:
- VERSION = '0.4.0'
+ VERSION = '0.4.1'
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
# :startdoc:
diff --git a/lib/org-ruby/html_output_buffer.rb b/lib/org-ruby/html_output_buffer.rb
index d1baf18..c5bf4cc 100644
--- a/lib/org-ruby/html_output_buffer.rb
+++ b/lib/org-ruby/html_output_buffer.rb
@@ -49,10 +49,11 @@ module Orgmode
def flush!
@logger.debug "FLUSH ==========> #{@output_type}"
+ escape_buffer!
if current_mode == :code then
# Whitespace is significant in :code mode. Always output the buffer
# and do not do any additional translation.
- @output << CGI.escapeHTML(@buffer) << "\n"
+ @output << @buffer << "\n"
else
if (@buffer.length > 0) then
output_indentation
@@ -68,6 +69,11 @@ module Orgmode
######################################################################
private
+ # Escapes any HTML content in the output accumulation buffer @buffer.
+ def escape_buffer!
+ @buffer = CGI.escapeHTML(@buffer)
+ end
+
def output_indentation
indent = " " * (@mode_stack.length - 1)
@output << indent
diff --git a/spec/html_examples/html-literal.html b/spec/html_examples/html-literal.html
new file mode 100644
index 0000000..11f1c85
--- /dev/null
+++ b/spec/html_examples/html-literal.html
@@ -0,0 +1,2 @@
+<p class="title">HTML literals</p>
+<p>ORG escapes HTML by default. This should <b>not be bold text!</b> Instead, it should look like regular text with some HTML tags around it.</p>
diff --git a/spec/html_examples/html-literal.org b/spec/html_examples/html-literal.org
new file mode 100644
index 0000000..dd424f9
--- /dev/null
+++ b/spec/html_examples/html-literal.org
@@ -0,0 +1,6 @@
+HTML literals
+
+ORG escapes HTML by default. This should <b>not be bold text!</b>
+Instead, it should look like regular text with some HTML tags around
+it.
+
--
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