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
shortcode-1.0.2 lib/shortcode/transformer.rb
shortcode-1.0.0 lib/shortcode/transformer.rb
shortcode-0.4.3 lib/shortcode/transformer.rb
shortcode-0.4.2 lib/shortcode/transformer.rb
shortcode-0.4.1 lib/shortcode/transformer.rb
shortcode-0.4.0 lib/shortcode/transformer.rb
shortcode-0.3.3 lib/shortcode/transformer.rb
shortcode-0.3.2 lib/shortcode/transformer.rb
shortcode-0.3.1 lib/shortcode/transformer.rb
shortcode-0.3.0 lib/shortcode/transformer.rb
shortcode-0.2.0 lib/shortcode/transformer.rb