File: clean_comment.rb

package info (click to toggle)
ruby-sanitize 7.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 324 kB
  • sloc: ruby: 3,153; makefile: 6
file content (13 lines) | stat: -rw-r--r-- 260 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

class Sanitize
  module Transformers
    CleanComment = lambda do |env|
      node = env[:node]

      if node.type == Nokogiri::XML::Node::COMMENT_NODE
        node.unlink unless env[:is_allowlisted]
      end
    end
  end
end