update the partial template to include the typesetting fix

This commit is contained in:
Jason TIAN 2023-02-12 10:00:54 +08:00
parent 8e184b0a05
commit 9a8cf9a29d
6 changed files with 30 additions and 5 deletions

View File

@ -50,7 +50,7 @@
<div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes" | default "serif"}} f5 nested-links nested-img mid-gray pr4-l w-two-thirds-l">
{{/* - .Content - */}}
{{- partial "replace-content-with-keywords-links.html" . -}}
{{- partial "replace-content.html" . -}}
{{- partial "tags.html" . -}}
<div class="mt6 instapaper_ignoref">

View File

@ -40,7 +40,10 @@
</header>
<div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes" | default "serif"}} f5 nested-links nested-img mid-gray pr4-l w-two-thirds-l">
{{- partial "author-reader.html" . -}}
{{- .Content -}}
{{/* - .Content - */}}
{{- partial "replace-content.html" . -}}
{{- partial "episodes-list.html" . -}}
{{- partial "section.html" . -}}
{{- partial "tags.html" . -}}

View File

@ -1,4 +1,4 @@
{{/* this is used to replace the keywords in content with links
{{/* this is used to replace the keywords & characters in content, to implement internal links and for better typesetting
reference:
- https://discourse.gohugo.io/t/replace-function-when-applied-to-content-displays-html-tags-instead-of-rendering-them/37717
@ -30,4 +30,22 @@ https://gohugo.io/templates/rss/#reference-your-rss-feed-in-head
{{/* end - range the CSV keywords */}}
{{ end }}
{{*/ start the better-typesetting replacement */}}
{{ $url := "static/csv/better-typesetting.csv" }}
{{ $sep := "," }}
{{/* start - range the CSV keywords */}}
{{ range $i, $r := getCSV $sep $url }}
{{ $old := index $r 0 }}
{{ $new := index $r 1 }}
{{- if (strings.Contains $Content $old) -}}
{{ $Content = replace $Content $old $new }}
{{ end }}
{{/* end - range the CSV keywords */}}
{{ end }}
{{ $Content | safeHTML }}

View File

@ -40,7 +40,10 @@
</header>
<div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes" | default "serif"}} f5 nested-links nested-img mid-gray pr4-l w-two-thirds-l">
{{- partial "author-reader.html" . -}}
{{- .Content -}}
{{/* - .Content - */}}
{{- partial "replace-content.html" . -}}
{{- partial "audio-player.html" . -}}
{{- partial "episodes-list.html" . -}}
{{- partial "tags.html" . -}}

View File

@ -43,7 +43,7 @@
<div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes" | default "serif"}} f5 nested-links nested-img mid-gray pr4-l w-two-thirds-l">
{{/* - .Content - */}}
{{- partial "replace-content-with-keywords-links.html" . -}}
{{- partial "replace-content.html" . -}}
{{- partial "list-reader-books.html" . -}}
{{- partial "list-reader-episodes.html" . -}}

View File

@ -0,0 +1 @@
·,・
1 ·