Sha256: 94ef60803620c3969baccb84a3626b5b02f429b0419448a35eed9a39b70b49a7

Contents?: true

Size: 474 Bytes

Versions: 3

Compression:

Stored size: 474 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).render }
  rule(
    open_close: simple(:name),
    options:    subtree(:options)
  ) { Shortcode::Tag.new(name.to_s, options).render }

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shortcode-0.1.2 lib/shortcode/transformer.rb
shortcode-0.1.1 lib/shortcode/transformer.rb
shortcode-0.1.0 lib/shortcode/transformer.rb