Class: Raw::LocalizationFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/raw/compiler/filter/localization.rb

Overview

Transform localzation macros.

Instance Method Summary collapse

Instance Method Details

#apply(source) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/raw/compiler/filter/localization.rb', line 7

def apply(source)
  source = source.dup
  
  # handle symbols.
  
  source.gsub!(/\[\[\:(.*?)\]\]/, '#{@lc[\1]}')

  # handle strings.
   
  source.gsub!(/\[\[(.*?)\]\]/, '#{@lc["\1"]}')

  return text
end