Sha256: 3ff12840d8cbef55e75d6e4affe38332e93402ea4bcc6aea1b7d8bf1959dcf1a
Contents?: true
Size: 644 Bytes
Versions: 3
Compression:
Stored size: 644 Bytes
Contents
# Adds slide language selection to the compiler class Showoff::Compiler::I18n def self.selectLanguage!(content) translations = {} content.scan(/^((~~~LANG:([\w-]+)~~~\n)(.+?)(\n~~~ENDLANG~~~))/m).each do |match| markup, opentag, code, text, closetag = match translations[code] = {:markup => markup, :content => text} end lang = Showoff::Locale.resolve(translations.keys).to_s translations.each do |code, translation| if code == lang content.sub!(translation[:markup], translation[:content]) else content.sub!(translation[:markup], "\n") end end content end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
showoff-0.20.4 | lib/showoff/compiler/i18n.rb |
showoff-0.20.3 | lib/showoff/compiler/i18n.rb |
showoff-0.20.2 | lib/showoff/compiler/i18n.rb |