Sha256: 0064eda265061f5dac5b68989e48d901251a88fa222d61fff66e57f139822bfe

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require 'parslet'
require 'haml'
require 'erb'
require 'facets/module/mattr'

module Shortcode

  # Sets the template parser to use, supports :erb and :haml, default is :haml
  mattr_accessor :template_parser
  @@template_parser = :haml

  # Sets the template parser to use, supports :erb and :haml, default is :haml
  mattr_accessor :template_path
  @@template_path = "app/views/shortcode_templates"

  # Set the supported block_tags
  mattr_accessor :block_tags
  @@block_tags = [:quote]

  # Set the supported self_closing_tags
  mattr_accessor :self_closing_tags
  @@self_closing_tags = [:youtube]

  def self.setup
    yield self
  end

  def self.process(code)
    transformer.apply(parser.parse(code))
  end

  private

    def self.parser
      @@parser ||= Shortcode::Parser.new
    end

    def self.transformer
      @@transformer ||= Shortcode::Transformer.new
    end

end

require 'shortcode/version'
require 'shortcode/parser'
require 'shortcode/transformer'
require 'shortcode/tag'
require 'shortcode/exceptions'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shortcode-0.0.2 lib/shortcode.rb