Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decreasing header values cause an exception. #89

Open
tenderlove opened this issue Aug 2, 2016 · 0 comments
Open

Decreasing header values cause an exception. #89

tenderlove opened this issue Aug 2, 2016 · 0 comments

Comments

@tenderlove
Copy link

If you have a wiki page that starts at header level 3, then goes to 2, then 1, you get an exception on the level 1 header.

Here's an example:

require 'wikicloth'

WikiCloth::WikiCloth.new(:data => DATA.read)

__END__
=== X ===

== Y ==

= Z =

If I run the above program, I get this exception:

[aaron@TC wikicloth (master)]$ ruby -I lib test.rb 
/Users/aaron/github/repos/wikicloth/lib/wikicloth.rb:42:in `block in load': undefined method `<<' for nil:NilClass (NoMethodError)
    from /Users/aaron/github/repos/wikicloth/lib/wikicloth.rb:37:in `each_line'
    from /Users/aaron/github/repos/wikicloth/lib/wikicloth.rb:37:in `load'
    from /Users/aaron/github/repos/wikicloth/lib/wikicloth.rb:26:in `initialize'
    from test.rb:3:in `new'
    from test.rb:3:in `<main>'
[aaron@TC wikicloth (master)]$

I'd expect it to output h3, then h2, then h1.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant