Sha256: 7b588ad784eb8697ca43cdd1ad5bec78f67b8ade808835ce95b615cf93052b91

Contents?: true

Size: 1.1 KB

Versions: 18

Compression:

Stored size: 1.1 KB

Contents

require 'gettext/tools'
require 'spiderfw/templates/blocks/text'

module Spider; module I18n

    module SHTMLParser
        module_function

        def target?(file)
            File.extname(file) == '.shtml'
        end

        def parse(file, ary)
            f = File.new(file)
            cnt = 0
            f.each_line do |line|
                cnt += 1
                scanner = ::StringScanner.new(line)
                while scanner.scan_until(Spider::TemplateBlocks::GettextRegexp)
                    str = scanner.matched
                    str =~ Spider::TemplateBlocks::GettextRegexp
                    found = false
                    ary.each do |msg|
                        if (msg[0] == $2)
                            msg << "#{file}:#{cnt}"
                            found = true
                            break
                        end
                    end
                    ary << [$2, "#{file}:#{cnt}"] unless found
                end
            end
            f.close
            return ary    
        end

    end
    
    ::GetText::RGetText.add_parser(SHTMLParser)

end; end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
spiderfw-0.6.39 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.38 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.37 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.35 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.34 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.33 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.32 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.31 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.30 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.29 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.28 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.27 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.26 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.26.pre1 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.25 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.24 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.23 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.22 lib/spiderfw/i18n/shtml_parser.rb