mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-29 15:54:05 -06:00
Added comments to textprocessing.html
This commit is contained in:
parent
18f1ce5d16
commit
63f50d84df
@ -26,29 +26,39 @@
|
|||||||
|
|
||||||
{{if not $incode}}
|
{{if not $incode}}
|
||||||
|
|
||||||
|
<!-- remove link delimiters -->
|
||||||
{{$inner := . | strings.TrimPrefix "!" | strings.TrimPrefix "[[" | strings.TrimSuffix "]]" }}
|
{{$inner := . | strings.TrimPrefix "!" | strings.TrimPrefix "[[" | strings.TrimSuffix "]]" }}
|
||||||
|
<!-- split from alias -->
|
||||||
{{$split := split $inner "|"}}
|
{{$split := split $inner "|"}}
|
||||||
|
<!-- separate link path -->
|
||||||
{{$path := index $split 0}}
|
{{$path := index $split 0}}
|
||||||
|
|
||||||
{{$reference := split $path "#"}}
|
{{$reference := split $path "#"}}
|
||||||
|
<!-- path with heading link removed -->
|
||||||
{{$title := index $reference 0}}
|
{{$title := index $reference 0}}
|
||||||
|
<!-- $display is hyperlink display text -->
|
||||||
|
<!-- use alias, else title -->
|
||||||
{{$display := default $title (index $split 1)}}
|
{{$display := default $title (index $split 1)}}
|
||||||
|
<!-- remove subfolder from title -->
|
||||||
{{$display := index (last 1 (split $display "/")) 0}}
|
{{$display := index (last 1 (split $display "/")) 0}}
|
||||||
|
|
||||||
{{$curpage := $page.GetPage $title}}
|
{{$curpage := $page.GetPage $title}}
|
||||||
{{$relpath := relURL $path}}
|
{{$relpath := relURL $path}}
|
||||||
|
|
||||||
|
<!-- If path to Hugo page -->
|
||||||
{{if not (eq $curpage.String "nopPage") }}
|
{{if not (eq $curpage.String "nopPage") }}
|
||||||
{{$block := default "" (index $reference 1)}}
|
{{$block := default "" (index $reference 1)}}
|
||||||
{{$block = strings.TrimRight "/" (cond (eq $block "") $block (printf "#%s" $block)) | urlize | lower}}
|
{{$block = strings.TrimRight "/" (cond (eq $block "") $block (printf "#%s" $block)) | urlize | lower}}
|
||||||
{{$href := strings.TrimRight "/" $curpage.RelPermalink}}
|
{{$href := strings.TrimRight "/" $curpage.RelPermalink}}
|
||||||
{{$link := printf "<a href=\"%s%s\" rel=\"noopener\" class=\"internal-link\" data-src=\"%s\">%s</a>" $href $block $href $display}}
|
{{$link := printf "<a href=\"%s%s\" rel=\"noopener\" class=\"internal-link\" data-src=\"%s\">%s</a>" $href $block $href $display}}
|
||||||
{{$content = replace $content . $link}}
|
{{$content = replace $content . $link}}
|
||||||
|
<!-- If path to existing file -->
|
||||||
{{else if fileExists $relpath}}
|
{{else if fileExists $relpath}}
|
||||||
{{$splitpath := split $relpath "/"}}
|
{{$splitpath := split $relpath "/"}}
|
||||||
{{$dirname := first (sub (len $splitpath) 1) $splitpath | path.Join | urlize}}
|
{{$dirname := first (sub (len $splitpath) 1) $splitpath | path.Join | urlize}}
|
||||||
{{$basename := index (last 1 $splitpath) 0}}
|
{{$basename := index (last 1 $splitpath) 0}}
|
||||||
{{$href := printf "/%s/%s" $dirname $basename}}
|
{{$href := printf "/%s/%s" $dirname $basename}}
|
||||||
|
<!-- Embedded? -->
|
||||||
{{if (hasPrefix . "!")}}
|
{{if (hasPrefix . "!")}}
|
||||||
{{$width := index $split 1}}
|
{{$width := index $split 1}}
|
||||||
{{$link := printf "<img src=\"%s\" width=\"%s\" />" $href (default "auto" $width)}}
|
{{$link := printf "<img src=\"%s\" width=\"%s\" />" $href (default "auto" $width)}}
|
||||||
@ -57,6 +67,7 @@
|
|||||||
{{$link := printf "<a href=\"%s\" rel=\"noopener\" class=\"internal-link\">%s</a>" $href $display}}
|
{{$link := printf "<a href=\"%s\" rel=\"noopener\" class=\"internal-link\">%s</a>" $href $display}}
|
||||||
{{$content = replace $content . $link}}
|
{{$content = replace $content . $link}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
<!-- Broken path -->
|
||||||
{{else}}
|
{{else}}
|
||||||
{{$link := printf "<a class=\"internal-link broken\">%s</a>" $display}}
|
{{$link := printf "<a class=\"internal-link broken\">%s</a>" $display}}
|
||||||
{{$content = replace $content . $link}}
|
{{$content = replace $content . $link}}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user