Sha256: 4b19e9bd1d809ab938a148173684a27d489c8bac0c0df4d27cbcab627710dd61
Contents?: true
Size: 515 Bytes
Versions: 10
Compression:
Stored size: 515 Bytes
Contents
module Wovnrb class LinkReplacer < ReplacerBase def initialize(pattern, headers) @pattern = pattern @headers = headers end def replace(dom, lang) dom.xpath('//a').each do |node| next if wovn_ignore?(node) href = node.get_attribute('href') next if href =~ /^\s*\{\{.+\}\}\s*$/ next if href =~ /javascript:void\(/ new_href = lang.add_lang_code(href, @pattern, @headers) node.set_attribute('href', new_href) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems