Sha256: 066be6cb56d208441eb3c0aefe15fa4fce548e2b48dfab988a12419a5468f75e

Contents?: true

Size: 1.27 KB

Versions: 12

Compression:

Stored size: 1.27 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, 2024 Juergen Adams
#
# J1 Template 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_attributes 'role' => ''

    def process parent, target, attributes

      html = %(
        <div class="#{attributes['role']}">
          <div id="#{target}" class="range-slider speak2me-ignore"></div>
        </div>
      )

      create_pass_block parent, html, attributes, subs: nil
    end
  end

  block_macro SliderBlockMacro
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
j1-template-2024.2.1 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2024.2.0 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2024.1.5 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2024.1.4 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2024.1.3 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2024.1.2 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2024.1.1 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2024.1.0 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2024.0.3 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2024.0.2 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2024.0.1 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb
j1-template-2024.0.0 lib/starter_web/_plugins/asciidoctor/range-slider-block.rb