Sha256: 7d386934ccb5131203cf1c3a5e31871082d754625850478cb8f0db0938be2242

Contents?: true

Size: 1.1 KB

Versions: 36

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] == $1)
                            msg << "#{file}:#{cnt}"
                            found = true
                            break
                        end
                    end
                    ary << [$1, "#{file}:#{cnt}"] unless found
                end
            end
            f.close
            return ary    
        end

    end
    
    GetText::RGetText.add_parser(SHTMLParser)

end; end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
spiderfw-0.6.16 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.15 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.14 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.13 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.12 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.11 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.10 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.9 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.8 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.7 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.6 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.5 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.4 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.3 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.2 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.1 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.6.0 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.5.19 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.5.18 lib/spiderfw/i18n/shtml_parser.rb
spiderfw-0.5.17 lib/spiderfw/i18n/shtml_parser.rb