mirror of
				https://github.com/imfing/hextra.git
				synced 2025-10-30 23:00:13 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			644 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			644 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| {{- /*
 | |
| Create an icon.
 | |
| 
 | |
| @param {string} name The name of the icon.
 | |
| @param {string} attributes The attributes of the icon.
 | |
| 
 | |
| or
 | |
| 
 | |
| @param {string} 0 The name of the icon.
 | |
| 
 | |
| @example {{< icon name="github" >}}
 | |
| @example {{< icon "github" >}}
 | |
| */ -}}
 | |
| 
 | |
| {{- $name := .Get "name" | default (.Get 0) -}}
 | |
| {{- $icon := index site.Data.icons $name -}}
 | |
| {{- $attributes := .Get "attributes" | default "height=1em"}}
 | |
| 
 | |
| {{- if not $icon -}}
 | |
|   {{ errorf "icon %q not found" $name }}
 | |
| {{- end -}}
 | |
| 
 | |
| {{- $icon = replaceRE "<svg" (printf "<svg %s" $attributes) $icon -}}
 | |
| 
 | |
| <span class="hx:inline-block hx:align-text-bottom hextra-icon">
 | |
|   {{- $icon | safeHTML -}}
 | |
| </span>
 | 
