From e15e39155de54dc1624bab80eefbccd6a783cd0c Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Fri, 15 Jul 2022 21:26:31 +0000
Subject: [PATCH] fix: give precedence to date created over last modified if defined (#101)

---
 layouts/partials/textprocessing.html |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/layouts/partials/textprocessing.html b/layouts/partials/textprocessing.html
index 8e8c999..dfb0ff2 100644
--- a/layouts/partials/textprocessing.html
+++ b/layouts/partials/textprocessing.html
@@ -27,10 +27,8 @@
       {{$inner := . | strings.TrimPrefix "![[" | strings.TrimSuffix "]]" }}
       {{$split := split $inner "|"}}
       {{$path := index $split 0 | relURL}}
-      {{$reference := split $path "#"}}
-      {{$title := index $reference 0}}
-      {{$display := default $title (index $split 1)}}
-      {{$img := printf "<img src=\"%s\" title=\"%s\">" $path $display}}
+      {{$width := index $split 1}}
+      {{$img := printf "<img src=\"%s\" width=\"%s\" />" $path (default "auto" $width)}}
       {{$content = replace $content . $img}}
     {{else}}
       {{$inner := . | strings.TrimPrefix "[[" | strings.TrimSuffix "]]" }}
@@ -39,7 +37,7 @@
       {{$reference := split $path "#"}}
       {{$title := index $reference 0}}
       {{$block := default "" (index $reference 1)}}
-      {{$block = strings.TrimRight "/" (cond (eq $block "") $block (printf "#%s" $block))}}
+      {{$block = strings.TrimRight "/" (cond (eq $block "") $block (printf "#%s" $block)) | urlize | lower}}
       {{$href := strings.TrimRight "/" ($page.GetPage $title).RelPermalink}}
       {{$display := default $title (index $split 1)}}
       {{if not $href}}
@@ -54,7 +52,7 @@
   {{end}}
 {{end}}
 
-{{/* Add copyable anchors */}}
+{{/* Add jumpable anchors */}}
 {{ $content = $content | replaceRE "(<h[1-9] id=\"([^\"]+)\">)(.+)(</h[1-9]>)" `<a href="#${2}">${1}<span class="hanchor" ariaLabel="Anchor"># </span>${3}${4}</a>` }}
 
 {{ $content | safeHTML }}

--
Gitblit v1.10.0