From 09b2818e2a8cdc43839bd51b9a41ebc21a3d41ba Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Thu, 23 Dec 2004 18:41:06 +0000 Subject: Fixed a code rendering problem; added HTML escaping. --- trunk/ruwiki/data/Ruwiki/ChangeLog.ruwiki | 4 ++++ trunk/ruwiki/lib/ruwiki/wiki.rb | 7 +++++++ trunk/ruwiki/lib/ruwiki/wiki/tokens/00default.rb | 3 +-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/trunk/ruwiki/data/Ruwiki/ChangeLog.ruwiki b/trunk/ruwiki/data/Ruwiki/ChangeLog.ruwiki index 018b151..da77bec 100644 --- a/trunk/ruwiki/data/Ruwiki/ChangeLog.ruwiki +++ b/trunk/ruwiki/data/Ruwiki/ChangeLog.ruwiki @@ -2,6 +2,10 @@ page!content: = Ruwiki %RV#% ChangeLog Uncompleted to-do items can be found in To_Do. Bugs in Ruwiki are tracked in BugTracking. + == 0.9.4 + * Fixed a \
 rendering problem.
+	* Added the ability to escape HTML tags. The opening and closing tags must be escaped independently, e.g., \\
 and \\
. + == 0.9.3 * Fixed a deployment problem because a RPA-modified file was checked in, preventing it from working on RubyGems. diff --git a/trunk/ruwiki/lib/ruwiki/wiki.rb b/trunk/ruwiki/lib/ruwiki/wiki.rb index ded37ee..3ae5a91 100644 --- a/trunk/ruwiki/lib/ruwiki/wiki.rb +++ b/trunk/ruwiki/lib/ruwiki/wiki.rb @@ -30,11 +30,18 @@ # == Tokens # Look at Ruwiki::Markup::Token describes how to create Token objects. class Ruwiki::Wiki + ESCAPED_TAGS_RE = %r{\\<([^>]+)>} + def parse(content, project) content = clean(content) tokens = [] project ||= @default_project + content.gsub!(ESCAPED_TAGS_RE) do |mm| + tag = Regexp.last_match.captures[0] + %Q(<#{tag}>) + end + Token.tokenlist.each do |token| content.gsub!(token.regexp) do |mm| match = Regexp.last_match diff --git a/trunk/ruwiki/lib/ruwiki/wiki/tokens/00default.rb b/trunk/ruwiki/lib/ruwiki/wiki/tokens/00default.rb index 996e376..d78d148 100644 --- a/trunk/ruwiki/lib/ruwiki/wiki/tokens/00default.rb +++ b/trunk/ruwiki/lib/ruwiki/wiki/tokens/00default.rb @@ -54,8 +54,7 @@ class Ruwiki::Wiki # Matches indented text. %r{^(\s+\S?.*)$} def self.regexp -# %r{^(\s+.*)$} - %r{^([ \t]+[^\n]*)\n?} + %r{^([ \t]+[^\n]*)} end # Replaces the text to
content
. -- cgit v1.2.1