6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/kitchen/directions/bake_figure.rb', line 6
def self.v1(figure:, number:, cases: false)
warn 'warning! exclude unnumbered figures from `BakeFigure` loop' if figure.unnumbered?
figure.wrap(%(<div class="os-figure#{' has-splash' if figure.has_class?('splash')}">))
figure.target_label(label_text: 'figure', custom_content: number, cases: cases)
title = figure.title&.cut
caption = figure.caption&.cut
figure.append(sibling:
" <div class=\"os-caption-container\">\n <span class=\"os-title-label\">\#{I18n.t(\"figure\#{'.nominative' if cases}\")} </span>\n <span class=\"os-number\">\#{number}</span>\n <span class=\"os-divider\"> </span>\n \#{\"<span class=\\\"os-title\\\" data-type=\\\"title\\\" id=\\\"\#{title.id}\\\">\#{title.children}</span>\" if title}\n <span class=\"os-divider\"> </span>\n \#{\"<span class=\\\"os-caption\\\">\#{caption.children}</span>\" if caption}\n </div>\n HTML\n )\nend\n"
|