From 63f50d84df2fb9879ddee5643d221792606a5c8a Mon Sep 17 00:00:00 2001 From: Apoorv Khandelwal Date: Wed, 30 Nov 2022 14:17:37 -0800 Subject: [PATCH] Added comments to textprocessing.html --- layouts/partials/textprocessing.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/layouts/partials/textprocessing.html b/layouts/partials/textprocessing.html index 24c65d07f..bc8d7d32a 100644 --- a/layouts/partials/textprocessing.html +++ b/layouts/partials/textprocessing.html @@ -26,29 +26,39 @@ {{if not $incode}} + {{$inner := . | strings.TrimPrefix "!" | strings.TrimPrefix "[[" | strings.TrimSuffix "]]" }} + {{$split := split $inner "|"}} + {{$path := index $split 0}} {{$reference := split $path "#"}} + {{$title := index $reference 0}} + + {{$display := default $title (index $split 1)}} + {{$display := index (last 1 (split $display "/")) 0}} {{$curpage := $page.GetPage $title}} {{$relpath := relURL $path}} + {{if not (eq $curpage.String "nopPage") }} {{$block := default "" (index $reference 1)}} {{$block = strings.TrimRight "/" (cond (eq $block "") $block (printf "#%s" $block)) | urlize | lower}} {{$href := strings.TrimRight "/" $curpage.RelPermalink}} {{$link := printf "%s" $href $block $href $display}} {{$content = replace $content . $link}} + {{else if fileExists $relpath}} {{$splitpath := split $relpath "/"}} {{$dirname := first (sub (len $splitpath) 1) $splitpath | path.Join | urlize}} {{$basename := index (last 1 $splitpath) 0}} {{$href := printf "/%s/%s" $dirname $basename}} + {{if (hasPrefix . "!")}} {{$width := index $split 1}} {{$link := printf "" $href (default "auto" $width)}} @@ -57,6 +67,7 @@ {{$link := printf "%s" $href $display}} {{$content = replace $content . $link}} {{end}} + {{else}} {{$link := printf "%s" $display}} {{$content = replace $content . $link}}