summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Ziegler <austin@rubyforge.org>2004-12-23 18:41:06 +0000
committerAustin Ziegler <austin@rubyforge.org>2004-12-23 18:41:06 +0000
commit09b2818e2a8cdc43839bd51b9a41ebc21a3d41ba (patch)
treeba55bdaa5d87539a035462a3d2f5f4e6d0597859
parentc4b141140c669330a733b81310b6a8007e613522 (diff)
downloaddiff-lcs-09b2818e2a8cdc43839bd51b9a41ebc21a3d41ba.tar.gz
Fixed a code rendering problem; added HTML escaping.
-rw-r--r--trunk/ruwiki/data/Ruwiki/ChangeLog.ruwiki4
-rw-r--r--trunk/ruwiki/lib/ruwiki/wiki.rb7
-rw-r--r--trunk/ruwiki/lib/ruwiki/wiki/tokens/00default.rb3
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 \<pre> rendering problem.
+ * Added the ability to escape HTML tags. The opening and closing tags must be escaped independently, e.g., \\<pre> and \\</pre>.
+
== 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(&lt;#{tag}&gt;)
+ 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 <pre>content</pre>.