Class: Nanoc::Filters::XSL Private
- Inherits:
-
Nanoc::Filter
- Object
- Int::Context
- Nanoc::Filter
- Nanoc::Filters::XSL
- Defined in:
- lib/nanoc/filters/xsl.rb
Overview
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.
Constant Summary
Constants inherited from Nanoc::Filter
Nanoc::Filter::TMP_BINARY_ITEMS_DIR
Instance Attribute Summary
Attributes inherited from Nanoc::Filter
Instance Method Summary collapse
-
#run(_content, params = {}) ⇒ String
private
Runs the item content through an [XSLT](www.w3.org/TR/xslt) stylesheet using [Nokogiri](nokogiri.org/).
Methods inherited from Nanoc::Filter
#depend_on, #filename, from_binary?, #initialize, #output_filename, requires, setup, #setup_and_run, to_binary?, type
Methods included from Int::PluginRegistry::PluginMethods
#all, #identifier, #identifiers, #named, #register
Methods inherited from Int::Context
Constructor Details
This class inherits a constructor from Nanoc::Filter
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](www.w3.org/TR/xslt) stylesheet using [Nokogiri](nokogiri.org/).
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.
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/nanoc/filters/xsl.rb', line 34 def run(_content, params = {}) Nanoc::Extra::JRubyNokogiriWarner.check_and_warn 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 |