Skip to content

Commit

Permalink
Allow no space between = and header
Browse files Browse the repository at this point in the history
  • Loading branch information
drbrain committed Apr 2, 2010
1 parent aa4e516 commit d44121d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions History.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ If you don't want to rebuild the rdoc for `gem server`, add --no-rdoc.
* N Bug Fixes
* RDoc::AnyMethod params now get saved in ri data.
* ri now displays method arguments correctly.
* RDoc::Markup::Parser allows no space between = and header text like rdoc
2.4 and earlier

=== 2.5 / 2010-03-31

Expand Down
2 changes: 1 addition & 1 deletion lib/rdoc/markup/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def tokenize input
token
when s.scan(/ +/) then
[:INDENT, s.matched_size, *token_pos(pos)]
when s.scan(/(=+)\s+/) then
when s.scan(/(=+)\s*/) then
level = s[1].length
level = 6 if level > 6
@tokens << [:HEADER, level, *token_pos(pos)]
Expand Down
18 changes: 18 additions & 0 deletions test/test_rdoc_markup_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,24 @@ def test_tokenize_heading_heading
assert_equal expected, @RMP.tokenize(str)
end

def test_tokenize_heading_no_space
str = <<-STR
=Heading
==Heading 2
STR

expected = [
[:HEADER, 1, 0, 0],
[:TEXT, 'Heading', 1, 0],
[:NEWLINE, "\n", 8, 0],
[:HEADER, 2, 0, 1],
[:TEXT, 'Heading 2', 2, 1],
[:NEWLINE, "\n", 11, 1],
]

assert_equal expected, @RMP.tokenize(str)
end

def test_tokenize_label
str = <<-STR
[cat] l1
Expand Down

0 comments on commit d44121d

Please sign in to comment.