Class: JekyllSupport::OutlineJsTag

Inherits:
JekyllTag
  • Object
show all
Includes:
JekyllOutlineVersion
Defined in:
lib/outline_js.rb

Constant Summary

Constants included from JekyllOutlineVersion

JekyllOutlineVersion::VERSION

Instance Method Summary collapse

Instance Method Details

#render_implObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/outline_js.rb', line 10

def render_impl
  wrap_in_script_tag = @helper.parameter_specified?('wrap_in_script_tag')

  gem_path = Gem::Specification.find_by_name('jekyll_outline').full_gem_path
  js_path = File.join(gem_path, 'demo/assets/js/jekyll_outline.js')
  js = File.read(js_path)

  if wrap_in_script_tag
    <<~END_JS
      <script>
        #{indent(js)}
      </script>
    END_JS
  else
    js
  end
end