main
html 29 lines 1.21 KB
Raw
1 {{- $content := .Content -}}
2 {{- $pressHeadings := slice `<h2 id="where-industry-meets-code">Where Industry Meets Code</h2>` `<h2 id=where-industry-meets-code>Where Industry Meets Code</h2>` -}}
3 {{- $pressHeading := "" -}}
4 {{- range $pressHeadings -}}
5 {{- if and (not $pressHeading) (in $content .) -}}
6 {{- $pressHeading = . -}}
7 {{- end -}}
8 {{- end -}}
9 {{- if $pressHeading -}}
10 {{- $parts := split $content $pressHeading -}}
11 {{- index $parts 0 | safeHTML -}}
12 {{- $afterHeading := index $parts 1 -}}
13 {{- $sectionParts := split $afterHeading "<h2" -}}
14 {{- $pressBody := index $sectionParts 0 -}}
15 {{- $remaining := "" -}}
16 {{- if gt (len $sectionParts) 1 -}}
17 {{- $remaining = print "<h2" (delimit (after 1 $sectionParts) "<h2") -}}
18 {{- end -}}
19 <aside class="press-context-callout" role="complementary" aria-labelledby="where-industry-meets-code">
20 <p class="press-context-callout__kicker">Industry &amp; Press</p>
21 <h2 id="where-industry-meets-code" class="press-context-callout__title">Where Industry Meets Code</h2>
22 <div class="press-context-callout__body">
23 {{- $pressBody | safeHTML -}}
24 </div>
25 </aside>
26 {{- $remaining | safeHTML -}}
27 {{- else -}}
28 {{- $content | safeHTML -}}
29 {{- end -}}