Bug in specification of node filters in v3.0.0
Closed this issue · 1 comments
If you configure a HTMLPipeline
with an odd number of node_filters
, you get an ArgumentError
:
ArgumentError:
odd number of arguments for Hash
Using an even number of node_filters
allows it to work as expected. I'd guess that the array is being turned into a Hash
somewhere, which does make me wonder if the node filters are being correctly called (but I haven't proven this yet).
This works:
input = "Hey there!"
HTMLPipeline.new(
convert_filter: HTMLPipeline::ConvertFilter::MarkdownFilter.new,
node_filters: [
HTMLPipeline::NodeFilter::SyntaxHighlightFilter.new,
HTMLPipeline::NodeFilter::TableOfContentsFilter.new,
HTMLPipeline::NodeFilter::EmojiFilter.new,
HTMLPipeline::NodeFilter::HttpsFilter.new,
]
).call(input)
This does not:
input = "Hey there!"
HTMLPipeline.new(
convert_filter: HTMLPipeline::ConvertFilter::MarkdownFilter.new,
node_filters: [
HTMLPipeline::NodeFilter::SyntaxHighlightFilter.new,
HTMLPipeline::NodeFilter::TableOfContentsFilter.new,
HTMLPipeline::NodeFilter::EmojiFilter.new,
]
).call(input)
I'll have a further dig and PR if I can find the issue, but maybe someone else already knows!
Looks like this is being triggered here:
html-pipeline/lib/html_pipeline.rb
Line 181 in 6c9d27e
It doesn't fail until we have more than 2 node filters defined; when I stripped back to just 1, it worked correctly. As soon as I added the third, it failed. When I added the fourth, it worked!
I suspect it's going to fail with 5, work with 6 and so on...