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

Redcarpet HTML_TOC renderer initialization error #222

Closed
chiarello opened this Issue Feb 14, 2013 · 4 comments

Comments

Projects
None yet
2 participants
@chiarello

chiarello commented Feb 14, 2013

The initialization of the HTML_TOC renderer in Redcarpet is wrong. It halts with the following error:

ArgumentError: wrong number of arguments(1 for 0)

The problem comes from the following line in redcarpet.rb

renderer = renderer_class.new(renderer_options)
 ::Redcarpet::Markdown.new(renderer, options).render(content)

It seems that the render ::Redcarpet::Render::HTML_TOC doesn't accept parameters, maybe it's a bug of the redcarpet library. The following code temporarily solves the problem:

if renderer_class == ::Redcarpet::Render::HTML_TOC
  renderer = renderer_class.new
else
  renderer = renderer_class.new(renderer_options)
end
::Redcarpet::Markdown.new(renderer, options).render(content)
@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Feb 14, 2013

Member

Would #200 be what you are looking for? From what I can tell, that pull request would solve your problems, am I right?

Member

ddfreyne commented Feb 14, 2013

Would #200 be what you are looking for? From what I can tell, that pull request would solve your problems, am I right?

@chiarello

This comment has been minimized.

Show comment
Hide comment
@chiarello

chiarello Feb 14, 2013

Not really. That patch constrains you to have the toc flowing togheter with the html. For instance, I'm using the HTML and HTML_TOC to build the page and its toc into different reps.
The solution presented in #200 is good, but it doesn't allow you to perform only the HTML_TOC pass alone.

chiarello commented Feb 14, 2013

Not really. That patch constrains you to have the toc flowing togheter with the html. For instance, I'm using the HTML and HTML_TOC to build the page and its toc into different reps.
The solution presented in #200 is good, but it doesn't allow you to perform only the HTML_TOC pass alone.

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Feb 17, 2013

Member

Ah yes… it is odd that the HTML_TOC does not accept any options, unlike other renderers. I’d suggest opening a ticket on the Redcarpet 2 issue tracker and ask them to resolve the inconsistency. I’ll change the nanoc filters so that it can handle HTML_TOC nicely.

Member

ddfreyne commented Feb 17, 2013

Ah yes… it is odd that the HTML_TOC does not accept any options, unlike other renderers. I’d suggest opening a ticket on the Redcarpet 2 issue tracker and ask them to resolve the inconsistency. I’ll change the nanoc filters so that it can handle HTML_TOC nicely.

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Feb 20, 2013

Member

Fixed in #232!

Member

ddfreyne commented Feb 20, 2013

Fixed in #232!

@ddfreyne ddfreyne closed this Feb 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment