Class: Jekyll::Minibundle::MiniStampTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::Minibundle::MiniStampTag
- Defined in:
- lib/jekyll/minibundle/mini_stamp_tag.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(tag_name, text, _tokens) ⇒ MiniStampTag
constructor
A new instance of MiniStampTag.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, text, _tokens) ⇒ MiniStampTag
Returns a new instance of MiniStampTag.
8 9 10 11 12 13 14 |
# File 'lib/jekyll/minibundle/mini_stamp_tag.rb', line 8 def initialize(tag_name, text, _tokens) super @local_stamp_config = MiniStampTag .default_stamp_config .merge(parse_arguments(text.strip)) end |
Class Method Details
.default_stamp_config ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/jekyll/minibundle/mini_stamp_tag.rb', line 37 def self.default_stamp_config { 'source_path' => '', 'destination_path' => '', 'baseurl' => '', 'render_basename_only' => false, 'use_template' => false } end |
Instance Method Details
#render(context) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jekyll/minibundle/mini_stamp_tag.rb', line 16 def render(context) site = context.registers.fetch(:site) stamp_config = get_current_stamp_config(context) source_path = stamp_config.fetch('source_path') destination_path = stamp_config.fetch('destination_path') render_basename_only = stamp_config.fetch('render_basename_only') file = register_asset_file(site, source_path, destination_path) dst_path = Files.strip_dot_slash_from_path_start(file.destination_path_for_markup) url = if render_basename_only File.basename(dst_path) else stamp_config.fetch('baseurl') + dst_path end CGI.escape_html(url) end |