Module: Nitro::MarkupCompiler

Includes:
Markup
Defined in:
lib/nitro/compiler/markup.rb

Class Method Summary collapse

Class Method Details

.transform(text, compiler = nil) ⇒ Object

Transform the markup macros. Maps #(..) to :sanitize. Maps #|..| to :markup.

Additional markup macros:

Maps ”..” to #…to_link Maps {..} to #.. Maps #<..> to #..



18
19
20
21
22
23
24
25
26
27
# File 'lib/nitro/compiler/markup.rb', line 18

def self.transform(text, compiler = nil)
  text.gsub!(/\#\((.*?)\)/, '#{sanitize(\1)}')
  text.gsub!(/\#\|(.*?)\|/, '#{markup(\1)}')

  text.gsub!(/\'\'(.*?)\'\'/, '#{\1.to_link}')    
  text.gsub!(/\{\{(.*?)\}\}/, '#{R \1}')    
  text.gsub!(/\#\<(.*?)\>/, '#{R \1}')    
  
  return text
end