Sha256: 68bd314c7ff6502efb483df5df2b64020224036299b69369354c20d399ca20c2
Contents?: true
Size: 588 Bytes
Versions: 9
Compression:
Stored size: 588 Bytes
Contents
module Wovnrb class TextReplacer < ReplacerBase def initialize(text_index) @text_index = text_index end def replace(dom, lang) dom.xpath('//text()').each do |node| next if wovn_ignore?(node) node_text = node.content.strip # shouldn't need size check, but for now... if @text_index[node_text] && @text_index[node_text][lang.lang_code] && @text_index[node_text][lang.lang_code].size > 0 node.content = replace_text(node.content, @text_index[node_text][lang.lang_code][0]['data']) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems