Class: Jekyll::Archimate::ArchimateDiagramTag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll/archimate/archimate_diagram_tag.rb

Overview

Insert a diagram from the ArchiMate model.

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, args_text, tokens) ⇒ ArchimateDiagramTag

Returns a new instance of ArchimateDiagramTag.



11
12
13
14
15
16
17
# File 'lib/jekyll/archimate/archimate_diagram_tag.rb', line 11

def initialize(tag_name, args_text, tokens)
  super

  args = args_text.strip.split(" ")
  @diagram_id = args.shift.strip
  @caption = args.join(" ")
end

Instance Method Details

#render(context) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/jekyll/archimate/archimate_diagram_tag.rb', line 19

def render(context)
  baseurl = context.registers[:site].baseurl
  # TODO: make the archimate_dir configurable in _config.yml and as an
  #       optional argument in the tag.
  archimate_dir = [baseurl, "archimate", "svg"].join("/")
  <<~END
    <figure id="#{@diagram_id}">
    <a href="#{baseurl}/archimate/svg/#{@diagram_id}.svg" alt="View Full Screen">
    <span class="glyphicon glyphicon-fullscreen" style="float:right"></span>
    </a>
    <img src="#{baseurl}/archimate/svg/#{@diagram_id}.svg" class="img-responsive" alt="#{@caption}">
    <figcaption>
    #{@caption}
    <br/>
    <a href="#{baseurl}/archimate/index.html##{@diagram_id}">
    <small>View in ArchiMate Model Repository</small>
    </a>
    </figcaption>
    </figure>
  END
end