remove unnecessary regex, use encodeuri for label instead of replace
This commit is contained in:
		
							parent
							
								
									a14d06aa3d
								
							
						
					
					
						commit
						9292de6333
					
				
					 5 changed files with 5 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
{{$trimmed := strings.TrimSuffix ".md" (.Destination | safeURL)}}
 | 
			
		||||
{{$trimmed = replace $trimmed "%20" "-"}}
 | 
			
		||||
{{$external := strings.HasPrefix $trimmed "http" }}
 | 
			
		||||
{{ if $external }}
 | 
			
		||||
<a href="{{ $trimmed }}" rel="noopener">{{ .Text | safeHTML }}</a>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,3 @@
 | 
			
		|||
{{$content := replaceRE `a href="\.\.\/(.+%20.+)+"` `$1` .Content}}
 | 
			
		||||
{{$content = replace $content "%20" "-"}}
 | 
			
		||||
{{$content = $content | safeHTML}}
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
{{ partial "head.html" . }}
 | 
			
		||||
| 
						 | 
				
			
			@ -22,7 +19,7 @@
 | 
			
		|||
            {{ .TableOfContents }}
 | 
			
		||||
        </aside>
 | 
			
		||||
        {{end}}
 | 
			
		||||
        {{- $content -}}
 | 
			
		||||
        {{.Content}}
 | 
			
		||||
    </article>
 | 
			
		||||
    {{partial "footer.html" .}}
 | 
			
		||||
</div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue