Sha256: d832aa1864178446bf4777bdce0eb58403179e8d42966198e61a8fe2b412248c

Contents?: true

Size: 583 Bytes

Versions: 13

Compression:

Stored size: 583 Bytes

Contents

# frozen_string_literal: true

class HTMLPipeline
  class NodeFilter
    # HTML Filter for replacing http references to :http_url with https versions.
    # Subdomain references are not rewritten.
    #
    # Context options:
    #   :http_url - The HTTP url to force HTTPS. Falls back to :base_url
    class HttpsFilter < NodeFilter
      SELECTOR = Selma::Selector.new(match_element: %(a[href^="http:"]))

      def selector
        SELECTOR
      end

      def handle_element(element)
        element["href"] = element["href"].sub(/^http:/, "https:")
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
html-pipeline-3.2.1 lib/html_pipeline/node_filter/https_filter.rb
html-pipeline-3.2.0 lib/html_pipeline/node_filter/https_filter.rb
html-pipeline-3.1.1 lib/html_pipeline/node_filter/https_filter.rb
html-pipeline-3.1.0 lib/html_pipeline/node_filter/https_filter.rb
html-pipeline-3.0.3 lib/html_pipeline/node_filter/https_filter.rb
html-pipeline-3.0.2 lib/html_pipeline/node_filter/https_filter.rb
html-pipeline-3.0.1 lib/html_pipeline/node_filter/https_filter.rb
html-pipeline-3.0.0 lib/html_pipeline/node_filter/https_filter.rb
html-pipeline-3.0.0.pre6 lib/html_pipeline/node_filter/https_filter.rb
html-pipeline-3.0.0.pre5 lib/html_pipeline/node_filter/https_filter.rb
html-pipeline-3.0.0.pre3 lib/html_pipeline/node_filter/https_filter.rb
html-pipeline-3.0.0.pre2 lib/html_pipeline/node_filter/https_filter.rb
html-pipeline-3.0.0.pre1 lib/html_pipeline/node_filter/https_filter.rb