diff options
author | Nobuyoshi Nakada <[email protected]> | 2022-11-30 22:59:15 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2022-12-01 02:36:20 +0900 |
commit | 99cad3fccdb9e7a66ff4c8231d43dafa336b2687 (patch) | |
tree | 65a3aa4e9a688da3a9fda90159840c5cf7e30270 | |
parent | c87b3ee671581594b60ae7cac05a053b1c12f3b9 (diff) |
[ruby/rdoc] Non-RD part feature has not been imported to RDoc
https://github.com/ruby/rdoc/commit/fe0159de2f
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6835
-rw-r--r-- | lib/rdoc/rd/block_parser.rb | 7 | ||||
-rw-r--r-- | test/rdoc/test_rdoc_rd_block_parser.rb | 21 |
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/rdoc/rd/block_parser.rb b/lib/rdoc/rd/block_parser.rb index 1241f81762..bfcc126ed2 100644 --- a/lib/rdoc/rd/block_parser.rb +++ b/lib/rdoc/rd/block_parser.rb @@ -127,15 +127,19 @@ def next_token # :nodoc: # non-RD part begin when /^=begin\s+(\w+)/ part = $1 +=begin # not imported to RDoc if @in_part # if in non-RD part @part_content.push(line) else @in_part = part if @tree.filter[part] # if filter exists # p "BEGIN_PART: #{@in_part}" # DEBUG end +=end + @in_part = part # non-RD part end when /^=end/ if @in_part # if in non-RD part +=begin # not imported to RDoc # p "END_PART: #{@in_part}" # DEBUG # make Part-in object part = RDoc::RD::Part.new(@part_content.join(""), @tree, "r") @@ -154,11 +158,14 @@ def next_token # :nodoc: end @in_part = nil return [:SUBTREE, subtree] +=end end else +=begin # not imported to RDoc if @in_part # if in non-RD part @part_content.push(line) end +=end end end diff --git a/test/rdoc/test_rdoc_rd_block_parser.rb b/test/rdoc/test_rdoc_rd_block_parser.rb index 22f432eaf4..ca0ac9f9e9 100644 --- a/test/rdoc/test_rdoc_rd_block_parser.rb +++ b/test/rdoc/test_rdoc_rd_block_parser.rb @@ -168,6 +168,27 @@ class TestRDocRdBlockParser < RDoc::TestCase tf.close! end +=begin + def test_parse_include_other_format + @block_parser.include_path = [Dir.tmpdir] + + expected = + doc( + blank_line, + para("include ((*worked*))"), + blank_line, + blank_line) + + str = <<~STR + =begin nonrd + <<< worked + =end + STR + + assert_equal(expected, @block_parser.parse str.lines.to_a) + end +=end + def test_parse_heading assert_equal doc(head(1, "H")), parse("= H") assert_equal doc(head(2, "H")), parse("== H") |