Sha256: b6e5bfd0b2ea82828ba0f0d37439e2fc9184381d5cd5caf59673d56f8cac134a

Contents?: true

Size: 1.17 KB

Versions: 38

Compression:

Stored size: 1.17 KB

Contents

# ------------------------------------------------------------------------------
# ~/_plugins/asciidoctor-extensions/range-slider-block.rb
# Asciidoctor extension for J1 range-slider (Owl range-slider)
#
# Product/Info:
# https://jekyll.one
#
# Copyright (C) 2023 Juergen Adams
#
# J1 Theme is licensed under the MIT License.
# See: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
#
# ------------------------------------------------------------------------------
require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal'
include Asciidoctor

# A block macro that embeds a range-slider block into the output document
#
# Usage
#
#   range_slider::slider-id[role="additional classes"]
#
# Example:
#
#   range_slider::example_slider[role="mb-5"]
#
Asciidoctor::Extensions.register do

  class SliderBlockMacro < Extensions::BlockMacroProcessor
    use_dsl

    named :range_slider
    name_positional_attributes 'role'
    default_attrs 'role' => ''

    def process parent, target, attrs
      html = %(<div id="#{target}" class="range-slider #{attrs['role']}"></div>)
      create_pass_block parent, html, attrs, subs: nil
    end
  end

  block_macro SliderBlockMacro

end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
j1-template-2023.6.0 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.5.2 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.4.5 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.4.4 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.4.3 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.4.2 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.4.1 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.4.0 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.3.3 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.3.2 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.3.1 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.3.0 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.2.7 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.2.6 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.2.5 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.2.4 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.2.3 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.2.2 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.2.1 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2023.2.0 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb