Sha256: 127ff6e334ada082381c41a43c17b251c2a7214d2a55b5f91b793f35746aa85c

Contents?: true

Size: 370 Bytes

Versions: 15

Compression:

Stored size: 370 Bytes

Contents

module InlineSvg::TransformPipeline::Transformations
  class Title < Transformation
    def transform(doc)
      doc = Nokogiri::XML::Document.parse(doc.to_html)
      node = Nokogiri::XML::Node.new('title', doc)
      node.content = value
      doc.search('svg title').each { |node| node.remove }
      doc.at_css('svg').prepend_child(node)
      doc
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
inline_svg-1.2.1 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-1.2.0 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-1.1.0 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-1.0.1 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-1.0.0 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-0.12.1 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-0.12.0 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-0.11.1 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-0.11.0 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-0.10.0 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-0.9.1 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-0.9.0 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-0.8.0 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-0.7.0 lib/inline_svg/transform_pipeline/transformations/title.rb
inline_svg-0.6.4 lib/inline_svg/transform_pipeline/transformations/title.rb