-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathfigure.html
More file actions
91 lines (79 loc) · 3.2 KB
/
figure.html
File metadata and controls
91 lines (79 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{{/*
doc: Figures
{{< figure >}}
src = 'https://source.unsplash.com/200x200/daily?cute+puppy'
alt = 'Cute puppies'
height = 200
width = 200
title = 'Figure title'
attribution = 'Figure Credits: Daily cute puppy image from unslash.com'
attributionlink = 'https://source.unsplash.com/200x200/daily?cute+puppy'
caption = '''
A figure is an image with a caption. Figures may also include a tile, legend, and/or attribution.
'''
legend = '''
{{< tomlToTable >}}
[[row]]
column = [
"Project",
"Available Packages",
"Download location"
]
[[row]]
column = [
"NumPy",
"Official *source code* (all platforms) and *binaries* for<br/>\n**Windows**, **Linux**, and **Mac OS X**\n",
"[PyPi page for NumPy](https://pypi.python.org/pypi/numpy)"
]
[[row]]
column = [
"SciPy",
"Official *source code* (all platforms) and *binaries* for<br/>\n**Windows**, **Linux** and **Mac OS X**\n",
"[SciPy release page](https://github.com/scipy/scipy/releases) (sources)<br/>\n[PyPI page for SciPy](https://pypi.python.org/pypi/scipy) (all)\n"
]
{{< /tomlToTable >}}
This paragraph is also part of the legend.
'''
{{< /figure >}}
{{< figure >}}
src = 'https://source.unsplash.com/200x200/daily?cute+puppy'
alt = 'Cute puppies'
attribution = 'from unslash.com'
attributionlink = 'https://source.unsplash.com/200x200/daily?cute+puppy'
align = 'left'
height = 150
width = 150
caption = '''
A figure with left alignment.
'''
{{< /figure >}}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
*/}}
{{- $figure := .Inner | transform.Unmarshal -}}
{{- $align := default "default" $figure.align -}}
{{- $id := printf "id%03d" $.Ordinal -}}
<figure class="align-{{ $align }}" id="{{ $id }}">
{{- $m := newScratch -}}
{{- $m.Set "image" $figure -}}
{{- $m.SetInMap "image" "align" "center" -}}
{{ partial "_elements/image.html" (dict "data" $m.Values.image) }}
<figcaption>
{{- with $figure.title -}}
<strong class="caption-title">{{ . }}</strong><a class="headerlink" href="#{{ $id }}" title="Link to this image">#</a><br>
{{- end }}
{{- if $figure.attribution -}}
{{- with $figure.attributionlink -}}<a href="{{ . }}">{{- end -}}{{- $figure.attribution -}}{{- if $figure.attributionlink -}}</a>{{- end -}}
{{- end }}
<p><span class="caption-text">
{{- $figure.caption | markdownify -}}
</span>
{{- with $figure.legend }}
<div class="legend">
{{- with (trim . "\n") }}
{{ . | safeHTML }}
{{- end }}
</div>
{{- end }}
</figcaption>
</figure>