Sha256: 3b8a55dd98bcd55de55d59211c1a1879ac374a3320d2a432e666d8690c557eff

Contents?: true

Size: 757 Bytes

Versions: 3

Compression:

Stored size: 757 Bytes

Contents

# frozen_string_literal: true

module ExtractI18n::Adapters
  class VuePugAdapter < SlimAdapter
    def process_line(old_line)
      @mode ||= :template
      if old_line[/^<template/]
        @mode = :template
      elsif old_line[/^<script/]
        @mode = :script
      elsif old_line[/^<style/]
        @mode = :style
      end
      if @mode != :template
        return old_line
      end
      word = ExtractI18n::Slimkeyfy::Word.for('.vue').new(old_line)
      ExtractI18n::Slimkeyfy::VueTransformer.new(word, @file_key).transform do |change|
        if change.nil? # nothing to do
          return old_line
        end

        if @on_ask.call(change)
          change.i18n_t
        else
          old_line
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
extract_i18n-0.6.2 lib/extract_i18n/adapters/vue_pug_adapter.rb
extract_i18n-0.6.1 lib/extract_i18n/adapters/vue_pug_adapter.rb
extract_i18n-0.6.0 lib/extract_i18n/adapters/vue_pug_adapter.rb