summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-23 21:10:42 +0000
committerdave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-23 21:10:42 +0000
commit74d704c2635484a12a47aeb2fbcf4c5f48cdbebd (patch)
treed92f534980fee2b66f1b06cc930b3f192bd82d21
parent2d0e62faf11eeee5c7564113ae76ddae49626087 (diff)
Fix constant value extraction. Escape HTML in constant values
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--lib/rdoc/generators/html_generator.rb2
-rw-r--r--lib/rdoc/parsers/parse_rb.rb12
3 files changed, 21 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index ce4a2ea164..184e05f4e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Tue Feb 24 06:08:47 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_constant):
+ Start collecting text of constant values earlier: was missing
+ values in output if there was no space after '='
+
+Tue Feb 24 06:08:25 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/generators/html_generator.rb: Escape contant values.
+
Tue Feb 24 03:45:06 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_config.c (ossl_config_each): add new method
diff --git a/lib/rdoc/generators/html_generator.rb b/lib/rdoc/generators/html_generator.rb
index b7d3961b45..a6a38f6a5c 100644
--- a/lib/rdoc/generators/html_generator.rb
+++ b/lib/rdoc/generators/html_generator.rb
@@ -348,7 +348,7 @@ module Generators
@context.constants.map do |co|
res = {
'name' => co.name,
- 'value' => co.value
+ 'value' => CGI.escapeHTML(co.value)
}
res['desc'] = markup(co.comment, true) if co.comment && !co.comment.empty?
res
diff --git a/lib/rdoc/parsers/parse_rb.rb b/lib/rdoc/parsers/parse_rb.rb
index 413167a39a..fd57ee2e4b 100644
--- a/lib/rdoc/parsers/parse_rb.rb
+++ b/lib/rdoc/parsers/parse_rb.rb
@@ -1510,6 +1510,10 @@ module RDoc
read
end
+ def peek_read
+ @read.join('')
+ end
+
NORMAL = "::"
SINGLE = "<<"
@@ -1814,6 +1818,10 @@ module RDoc
return
end
+
+ nest = 0
+ get_tkread
+
tk = get_tk
if tk.kind_of? TkGT
unget_tk(tk)
@@ -1821,11 +1829,10 @@ module RDoc
return
end
- nest = 0
- get_tkread
loop do
puts("Param: #{tk}, #{@scanner.continue} " +
"#{@scanner.lex_state} #{nest}") if $DEBUG
+
case tk
when TkSEMICOLON
break
@@ -1846,6 +1853,7 @@ module RDoc
end
tk = get_tk
end
+
res = get_tkread.tr("\n", " ").strip
res = "" if res == ";"
con = Constant.new(name, res, comment)