25 lines
		
	
	
		
			986 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			986 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
{{/* Partial: create_sigil.html */}}
 | 
						|
 | 
						|
{{- $input := . -}} <!-- The input string will be passed into the partial -->
 | 
						|
{{- $vowels := "aeiouAEIOU" -}} <!-- List of vowels to remove -->
 | 
						|
{{- $seen := dict -}} <!-- Dictionary to track characters we've already encountered -->
 | 
						|
{{- $output := "" -}} <!-- Variable to store the resulting sigil -->
 | 
						|
{{- $chars := split (replaceRE "[^a-zA-Z]" "" $input) "" -}} <!-- Remove non-alphabetic characters and split the input string into a slice of characters -->
 | 
						|
 | 
						|
{{- /* Step 1: Remove vowels */ -}}
 | 
						|
{{- range $i, $char := $chars -}}
 | 
						|
{{- if not (in $vowels $char) -}}
 | 
						|
{{- /* Step 2: Remove repeating letters */ -}}
 | 
						|
{{- if not (index $seen $char) -}}
 | 
						|
{{- $seen = merge $seen (dict $char true) -}}
 | 
						|
{{- $output = printf "%s%s" $output $char -}}
 | 
						|
{{- end -}}
 | 
						|
{{- end -}}
 | 
						|
{{- end -}}
 | 
						|
 | 
						|
{{- $output = upper $output -}}
 | 
						|
{{ $output = split $output "" }}
 | 
						|
{{ $output = apply $output "printf" "%#x" "." }}
 | 
						|
{{ $output = apply $output "int" "." }}
 | 
						|
 | 
						|
{{- $output -}}<br> |