Sha256: a483cb71ba1b2f5d0e97a1792a8bbdd6fdc3def3d759585c034ea2798e99d9ac

Contents?: true

Size: 620 Bytes

Versions: 2

Compression:

Stored size: 620 Bytes

Contents

require 'nitro/markup'

module Nitro

module MarkupCompiler
  include Markup
  
  # Transform the markup macros.
  # Maps #(..) to :sanitize.
  # Maps #|..| to :markup.
  #
  # Additional markup macros:
  #
  # Maps ''..'' to #{...to_link}
  # Maps {{..}} to #{R ..}
  # Maps #<..> to #{R ..}
  
  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
  
end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nitro-0.41.0 lib/nitro/compiler/markup.rb
nitro-0.40.0 lib/nitro/compiler/markup.rb