1- < figure {{ if or (.Get "class") (eq (.Get "align") "center") }} class="
2- {{- if eq (.Get "align ") "center" }}align-center {{ end }}
3- {{- with .Get "class" }}{{ . }}{{- end }}"
4- {{- end -}}>
1+ <!-- ==============================================================================
2+ - File: Academic_Figure.html (Semantic Media Container)
3+ - Author: Amey Thakur
4+ - Profile: https://github.com/Amey-Thakur
5+ - Repository: https://github.com/Amey-Thakur/Amey-Thakur.github.io
6+ - Release Date: December 16, 2025
7+ - License: MIT License
8+ - ==============================================================================
9+ -
10+ - DESCRIPTION:
11+ - This shortcode implements a semantic <figure> container for media assets.
12+ - It ensures scholarly rigor by associating high-fidelity imagery with
13+ - descriptive captions and attribution metadata.
14+ -
15+ - HOW IT WORKS:
16+ - The component parses input parameters (src, caption, attr) to architect
17+ - a responsive media block. It utilizes conditional logic for spatial
18+ - alignment, lazy-loading for performance, and markdown processing for
19+ - rich-text captions.
20+ -
21+ - TECH STACK:
22+ - - Hugo Shortcode API
23+ - - Semantic HTML5 Figure/Figcaption
24+ - - Markdown Rendering (markdownify)
25+ -
26+ - ============================================================================== -->
27+
28+ {{- /* Spatial Architecture: Defining the container grid and alignment modality. */ -}}
29+ < figure {{ if or (.Get "class" ) (eq (.Get "align" ) "center" ) }} class="
30+ {{- if eq (.Get " align ") "center" }}align-center {{ end }} {{- with .Get "class" }}{{ . }}{{- end }}" {{-
31+ end -}}>
32+ {{- /* Interactivity Layer: Handling optional hyperlinking for the media asset. */ -}}
533 {{- if .Get "link" -}}
6- < a href ="{{ .Get "link " }}"{{ with .Get "target" }} target="{{ . }} "{{ end }}{{ with .Get "rel" }} rel="{{ . }} "{{ end }} >
7- {{- end }}
8- < img loading ="lazy " src ="{{ .Get "src " }}{{- if eq (.Get "align") "center" }}#center{{- end }}"
9- {{- if or (.Get "alt") (.Get "caption") }}
10- alt="{{ with .Get "alt " }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
11- {{- end -}}
12- {{- with .Get "width" }} width="{{ . }} "{{ end -}}
13- {{- with .Get "height" }} height="{{ . }} "{{ end -}}
14- /> <!-- Closing img tag -->
15- {{- if .Get "link" }}</ a > {{ end -}}
34+ < a href ="{{ .Get " link " }}"{{ with .Get "target" }} target="{{ . }} " {{ end }}{{ with .Get "rel" }} rel="{{ . }} "
35+ {{ end }} >
36+ {{- end }}
37+ {{- /* Media Processor: Delivering the visual artifact with lazy-loading performance. */ -}}
38+ < img loading ="lazy " src ="{{ .Get " src " }}{{- if eq (.Get "align" ) "center" }}#center{{- end }}" {{- if or
39+ (.Get "alt" ) (.Get "caption" ) }} alt="{{ with .Get " alt " }}{{ . }}{{ else }}{{ .Get "caption" |
40+ markdownify | plainify }}{{ end }}" {{- end -}} {{- with .Get "width" }} width="{{ . }} " {{ end -}} {{- with
41+ .Get "height" }} height="{{ . }} " {{ end -}} />
42+ {{- if .Get "link" }}</ a > {{ end -}}
43+
44+ {{- /* Scholarly Metadata: Injecting semantic figcaptions and attribution trails. */ -}}
1645 {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
17- < figcaption >
18- {{ with (.Get "title") -}}
19- {{ . }}
20- {{- end -}}
21- {{- if or (.Get "caption") (.Get "attr") -}}< p >
22- {{- .Get "caption" | markdownify -}}
23- {{- with .Get "attrlink" }}
24- < a href ="{{ . }} ">
46+ < figcaption >
47+ {{ with (.Get "title") -}}
48+ {{ . }}
49+ {{- end -}}
50+ {{- if or (.Get "caption") (.Get "attr") -}}< p >
51+ {{- .Get "caption" | markdownify -}}
52+ {{- with .Get "attrlink" }}
53+ < a href ="{{ . }} ">
2554 {{- end -}}
2655 {{- .Get "attr" | markdownify -}}
27- {{- if .Get "attrlink" }}</ a > {{ end }}</ p >
28- {{- end }}
29- </ figcaption >
56+ {{- if .Get "attrlink" }}</ a > {{ end }}
57+ </ p >
58+ {{- end }}
59+ </ figcaption >
3060 {{- end }}
31- </ figure >
32-
61+ </ figure >
0 commit comments