Sha256: 96827aa0571e8cd8f58bc74999693586294d6dfde401307f240dd7421cffe025
Contents?: true
Size: 867 Bytes
Versions: 2
Compression:
Stored size: 867 Bytes
Contents
require 'jekyll_plugin_support' require_relative 'jekyll_outline/version' module JekyllSupport PLUGIN_JS_NAME = 'outline_js'.freeze class OutlineJsTag < JekyllTag include JekyllOutlineVersion 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 private def indent(multiline) multiline .strip .split("\n") .map { |x| " #{x}" } .join("\n") end JekyllPluginHelper.register(self, PLUGIN_JS_NAME) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jekyll_outline-1.2.5 | lib/outline_js.rb |
jekyll_outline-1.2.4 | lib/outline_js.rb |