Sha256: bf66771961c3db08f620c19efcc72ce2f117d2a1b164860215edc1ae82ebeeed

Contents?: true

Size: 456 Bytes

Versions: 9

Compression:

Stored size: 456 Bytes

Contents

module Wovnrb
  class ReplacerBase
    def replace(dom, lang)
      raise NotImplementedError.new('replace is not defined')
    end

    protected
    def wovn_ignore?(node)
      if !node.get_attribute('wovn-ignore').nil?
        return true
      elsif node.name === 'html'
        return false
      end
      wovn_ignore?(node.parent)
    end

    def replace_text(from, to)
      from.gsub(/\A(\s*)[\S\s]*?(\s*)\Z/, '\1' + to + '\2')
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
wovnrb-0.2.07.1 lib/wovnrb/html_replacers/replacer_base.rb
wovnrb-0.2.10 lib/wovnrb/html_replacers/replacer_base.rb
wovnrb-0.2.09 lib/wovnrb/html_replacers/replacer_base.rb
wovnrb-0.2.08 lib/wovnrb/html_replacers/replacer_base.rb
wovnrb-0.2.07 lib/wovnrb/html_replacers/replacer_base.rb
wovnrb-0.2.06 lib/wovnrb/html_replacers/replacer_base.rb
wovnrb-0.2.05 lib/wovnrb/html_replacers/replacer_base.rb
wovnrb-0.2.04 lib/wovnrb/html_replacers/replacer_base.rb
wovnrb-0.2.03 lib/wovnrb/html_replacers/replacer_base.rb