Class: Nanoc::Filters::XSL Private
- Inherits:
-
Nanoc::Filter
- Object
- Nanoc::Filters::XSL
- Defined in:
- lib/nanoc/filters/xsl.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
Instance Method Details
#run(_content, params = {}) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Runs the item content through an XSLT stylesheet using Nokogiri.
This filter can only be run for layouts, because it will need both the XML to convert (= the item content) as well as the XSLT stylesheet (= the layout content).
Additional parameters can be passed to the layout call. These parameters
will be turned into xsl:param elements.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/nanoc/filters/xsl.rb', line 38 def run(_content, params = {}) if assigns[:layout].nil? raise 'The XSL filter can only be run as a layout' end xml = ::Nokogiri::XML(assigns[:content]) xsl = ::Nokogiri::XSLT(assigns[:layout].raw_content) xsl.apply_to(xml, ::Nokogiri::XSLT.quote_params(params)) end |