Sha256: 97c42bbe24ebb1ef594d810e61fffe4301a147bdf2cf80a5467e93ac65cd69ce

Contents?: true

Size: 1.25 KB

Versions: 80

Compression:

Stored size: 1.25 KB

Contents

# ------------------------------------------------------------------------------
# ~/_plugins/asciidoctor-extensions/carousel-block.rb
# Asciidoctor extension for J1 Carousel (Owl Carousel)
#
# Product/Info:
# https://jekyll.one
#
# Copyright (C) 2021 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE
#
# ------------------------------------------------------------------------------
require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal'
include Asciidoctor

# A block macro that embeds a Carousel block into the output document
#
# Usage
#
#   carousel::carousel:id[role="additional classes"]
#
# Example:
#
#   .The carousel title
#   carousel::owl_demo_simple[role="mb-5"]
#
Asciidoctor::Extensions.register do

  class ImageBlockMacro < Extensions::BlockMacroProcessor
    use_dsl

    named :carousel
    name_positional_attributes 'role'

    def process parent, target, attrs

      title_html  = (attrs.has_key? 'title') ? %(<div class="slider-title">#{attrs['title']}</div>\n) : nil
      html = %(#{title_html} <div id="#{target}" class="#{attrs['role']}"></div>)
      create_pass_block parent, html, attrs, subs: nil
    end
  end

  block_macro ImageBlockMacro

end

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
j1-template-2021.3.1 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.3.0 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.2.12 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.2.11 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.2.10 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.2.9 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.2.8 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.2.7 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.2.6 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.2.5 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.2.4 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.2.3 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.2.2 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.2.1 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.2.0 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.1.29 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.1.28 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.1.27 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.1.26 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb
j1-template-2021.1.25 lib/starter_web/_plugins/asciidoctor-extensions/carousel-block.rb