Sha256: f3b63e6032f6af712630053877b7af834743c5ceb3ec7d63f4e67482b38e7a5b

Contents?: true

Size: 525 Bytes

Versions: 51

Compression:

Stored size: 525 Bytes

Contents

class Shortcode::Transformer < Parslet::Transform

  rule(text: simple(:text)) { String(text) }
  rule(
    open:     simple(:name),
    options:  subtree(:options),
    inner:    sequence(:inner),
    close:    simple(:name)
  ) { Shortcode::Tag.new(name.to_s, options, inner.join, additional_attributes).render }
  rule(
    open_close: simple(:name),
    options:    subtree(:options)
  ) { Shortcode::Tag.new(name.to_s, options, '', additional_attributes).render }

  rule(body: sequence(:strings)) { strings.join }

end

Version data entries

51 entries across 51 versions & 2 rubygems

Version Path
virgo-0.2.7 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.2.6 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.2.5 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.2.4 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.2.2 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.2.1 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.2 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.1.16 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.1.15 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.1.14 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.1.13 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.1.12 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.1.11 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.1.10 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.1.8 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.1.7 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.1.6 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.1.5 vendor/gems/shortcode/lib/shortcode/transformer.rb
virgo-0.1.4 vendor/gems/shortcode/lib/shortcode/transformer.rb
shortcode-1.1.0 lib/shortcode/transformer.rb