|
5 | 5 | {{ partial "sidebar.html" . }} |
6 | 6 | </nav> |
7 | 7 |
|
8 | | - {{$content := .Content}} |
9 | | - {{$pattern := `<i[^>]*class=["'][^"']*(?:fas?|fa-solid|fa-regular|fa-brands|far)\s+fa-([^"'\s]+)[^"']*["'][^>]*?(?:\s+style=["']([^"']*)["'])?[^>]*></i>`}} |
10 | | - {{$matches := findRE $pattern $content}} |
11 | | - |
12 | | - {{range $matches}} |
13 | | - {{$currentMatch := .}} |
14 | | - {{$iconName := ""}} |
15 | | - {{$styleAttr := ""}} |
16 | | - |
17 | | - {{$submatches := findRESubmatch $pattern $currentMatch}} |
18 | | - {{if gt (len $submatches) 0}} |
19 | | - {{$iconName = index (index $submatches 0) 1}} |
20 | | - {{$styleAttr = index (index $submatches 0) 2}} |
21 | | - |
22 | | - {{- $iconMappings := dict |
23 | | - "bug-slash" "bug-off" |
24 | | - "circle-info" "info" |
25 | | - "info-circle" "info" |
26 | | - "file-circle-plus" "file-plus" |
27 | | - "check-circle" "circle-check" |
28 | | - "heartbeat" "heart-pulse" |
29 | | - "code-branch" "git-branch" |
30 | | - "desktop" "monitor" |
31 | | - "certificate" "badge" |
32 | | - "cogs" "cog" |
33 | | - "shield-alt" "shield-half" |
34 | | - "memory" "cpu" |
35 | | - "hdd" "hard-drive" |
36 | | - "exclamation-triangle" "triangle-alert" |
37 | | - "triangle-exclamation" "triangle-alert" |
38 | | - "tachometer-alt" "circle-gauge" |
39 | | - "circle-exclamation" "circle-alert" |
40 | | - "arrow-up-right-from-square" "external-link" |
41 | | - "pen-to-square" "square-pen" |
42 | | - "flask" "flask-conical" |
43 | | - -}} |
44 | | - |
45 | | - {{ with index $iconMappings $iconName }} |
46 | | - {{$iconName = .}} |
47 | | - {{ end }} |
48 | | - |
49 | | - {{$iconHTML := partial "lucide" (dict |
50 | | - "context" $ |
51 | | - "icon" $iconName |
52 | | - "style" $styleAttr |
53 | | - )}} |
54 | | - |
55 | | - {{ $modifiedMatch := replaceRE `>` ` data-mf=false>` $currentMatch 1}} |
56 | | - {{ $modifiedMFIcon := printf "%s %s" $modifiedMatch $iconHTML }} |
57 | | - {{$content = replace $content $currentMatch $modifiedMFIcon}} |
58 | | - |
59 | | - {{end}} |
60 | | - {{end}} |
| 8 | + <!-- Replace icons --> |
| 9 | + {{ $content := partial "icon-replacement.html" (dict "content" .Content) }} |
61 | 10 |
|
62 | 11 | {{if (.Params.catalog) }} |
63 | 12 | <main class="content content-has-toc" role="main"> |
|
0 commit comments