Skip to content

Commit

Permalink
Non-RD part feature has not been imported to RDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Nov 30, 2022
1 parent 0b9dde5 commit fe0159d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/rdoc/rd/block_parser.ry
Original file line number Diff line number Diff line change
Expand Up @@ -339,15 +339,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")
Expand All @@ -366,11 +370,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

Expand Down
21 changes: 21 additions & 0 deletions test/rdoc/test_rdoc_rd_block_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,27 @@ def test_parse_include_subtree
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")
Expand Down

0 comments on commit fe0159d

Please sign in to comment.