You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So we can pass context to a convert filter and node filters only when a pipeline is constructed by HTMLPipeline.new, and cannot pass it to them when the pipeline is called.
On html-pipeline v2, the context hash is actually passed into all filters:
rewriting a document of HTMLPipeline#call to reflect the current behavior, or
adding context and result parameters to call methods of convert filters and node filters?
For option 2, changing the interface is a bit difficult because for node filters we should modify @context of given node filters before passing the filters to Selma::Rewriter#new.
Environment: html-pipeline v3.1.1
The text was updated successfully, but these errors were encountered:
Hi, I opened #402 to address this. In summary: no, this should not have been removed. Context should be able to be passed at call time to each filter, too. That way you set up one pipeline and it renders the same content in different ways, depending on the context hash at the time (or the global context you set up when first defining the pipeline).
In any case, take a look at that branch and let me know if that works for your use case.
The doc of
HTMLPipeline#call
says that itscontext
parameter is passed to each filter:html-pipeline/lib/html_pipeline.rb
Lines 137 to 149 in aec775c
But in fact, the
context
is only passed to each text filters, and not passed to a convert filter and all node filters:html-pipeline/lib/html_pipeline.rb
Line 213 in aec775c
html-pipeline/lib/html_pipeline.rb
Line 174 in aec775c
html-pipeline/lib/html_pipeline.rb
Line 180 in aec775c
So we can pass context to a convert filter and node filters only when a pipeline is constructed by
HTMLPipeline.new
, and cannot pass it to them when the pipeline is called.On html-pipeline v2, the context hash is actually passed into all filters:
html-pipeline/lib/html/pipeline.rb
Lines 118 to 120 in 84c75b3
Is this an intended change? If so, how about:
HTMLPipeline#call
to reflect the current behavior, orcontext
andresult
parameters tocall
methods of convert filters and node filters?For option 2, changing the interface is a bit difficult because for node filters we should modify
@context
of given node filters before passing the filters toSelma::Rewriter#new
.Environment: html-pipeline v3.1.1
The text was updated successfully, but these errors were encountered: