Skip to content

Commit 6d5a140

Browse files
committed
Fix % string literal with operator
For example, %*string* is changed to %Q*string*. It's equivalent string literal to be sure, but this is not good for source code in HTML. This commit fixes it.
1 parent 0c47b30 commit 6d5a140

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/rdoc/ruby_lex.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ def identify_string(ltype, quoted = ltype, type = nil)
12111211
str = if ltype == quoted and %w[" ' /].include? ltype then
12121212
ltype.dup
12131213
else
1214-
"%#{type or PERCENT_LTYPE.key ltype}#{PERCENT_PAREN_REV[quoted]||quoted}"
1214+
"%#{type}#{PERCENT_PAREN_REV[quoted]||quoted}"
12151215
end
12161216

12171217
subtype = nil

test/test_rdoc_parser_ruby.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2838,7 +2838,7 @@ def test_sanity_interpolation_crazy
28382838
def test_sanity_interpolation_curly
28392839
util_parser '%{ #{} }'
28402840

2841-
assert_equal '%Q{ #{} }', @parser.get_tk.text
2841+
assert_equal '%{ #{} }', @parser.get_tk.text
28422842
assert_equal RDoc::RubyToken::TkNL, @parser.get_tk.class
28432843
end
28442844

0 commit comments

Comments
 (0)