Compare commits

...

6 Commits

Author SHA1 Message Date
Mark Dumay
7413155dea Merge pull request #1108 from gethinode/develop
Fix embedded and anchor links
2024-08-16 11:04:54 +02:00
Mark Dumay
cfd1706f5f Merge branch 'main' into develop 2024-08-16 10:58:37 +02:00
Mark Dumay
5eca63c50d Fix embedded and anchor links 2024-08-16 10:58:05 +02:00
Mark Dumay
d3f471a281 Merge pull request #1107 from gethinode/develop
Use utility function to retrieve the page associated with a card
2024-08-16 10:55:56 +02:00
Mark Dumay
b4acd7aef2 Merge branch 'main' into develop 2024-08-16 10:51:11 +02:00
Mark Dumay
49a3ef3c42 Use utility function to retrieve the page associated with a card 2024-08-16 10:50:36 +02:00
8 changed files with 47 additions and 56 deletions

2
go.mod
View File

@@ -11,7 +11,7 @@ require (
github.com/gethinode/mod-leaflet v1.1.1 // indirect github.com/gethinode/mod-leaflet v1.1.1 // indirect
github.com/gethinode/mod-lottie v1.5.6 // indirect github.com/gethinode/mod-lottie v1.5.6 // indirect
github.com/gethinode/mod-simple-datatables v1.0.7 // indirect github.com/gethinode/mod-simple-datatables v1.0.7 // indirect
github.com/gethinode/mod-utils/v2 v2.3.10 // indirect github.com/gethinode/mod-utils/v2 v2.4.0 // indirect
github.com/nextapps-de/flexsearch v0.0.0-20240501124520-961c3ae84a87 // indirect github.com/nextapps-de/flexsearch v0.0.0-20240501124520-961c3ae84a87 // indirect
github.com/twbs/bootstrap v5.3.3+incompatible // indirect github.com/twbs/bootstrap v5.3.3+incompatible // indirect
) )

2
go.sum
View File

@@ -258,6 +258,8 @@ github.com/gethinode/mod-utils/v2 v2.3.9 h1:Z9uAr6S0wunlkfKHa2D/U83fBV6Ivtf+7sjB
github.com/gethinode/mod-utils/v2 v2.3.9/go.mod h1:GTYeknoLujNjfDxI+V9Dcug26CYJSTJ0B/U2dagw9oY= github.com/gethinode/mod-utils/v2 v2.3.9/go.mod h1:GTYeknoLujNjfDxI+V9Dcug26CYJSTJ0B/U2dagw9oY=
github.com/gethinode/mod-utils/v2 v2.3.10 h1:+coUXdgAbLEE8Tvb3Rfk/1Nr6oDVreXI2sil0pa/n2Q= github.com/gethinode/mod-utils/v2 v2.3.10 h1:+coUXdgAbLEE8Tvb3Rfk/1Nr6oDVreXI2sil0pa/n2Q=
github.com/gethinode/mod-utils/v2 v2.3.10/go.mod h1:GTYeknoLujNjfDxI+V9Dcug26CYJSTJ0B/U2dagw9oY= github.com/gethinode/mod-utils/v2 v2.3.10/go.mod h1:GTYeknoLujNjfDxI+V9Dcug26CYJSTJ0B/U2dagw9oY=
github.com/gethinode/mod-utils/v2 v2.4.0 h1:mmG4hWaeA4krAg933pibH+TrjFmPHkAi/DUbe3SM38I=
github.com/gethinode/mod-utils/v2 v2.4.0/go.mod h1:GTYeknoLujNjfDxI+V9Dcug26CYJSTJ0B/U2dagw9oY=
github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3 h1:H/qVR5O4BXjRjD+5PZB+r4ug2BSJ2Of4RtwOntd+OKo= github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3 h1:H/qVR5O4BXjRjD+5PZB+r4ug2BSJ2Of4RtwOntd+OKo=
github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3/go.mod h1:5GdMfPAXzbA2gXBqTjC6l27kioSYzHlqDMh0+wyx7sU= github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3/go.mod h1:5GdMfPAXzbA2gXBqTjC6l27kioSYzHlqDMh0+wyx7sU=
github.com/nextapps-de/flexsearch v0.0.0-20240108021025-afd75f742f22 h1:re7L8FxbXQpnX8BgzkdUnDpsUmloGNyLmiy2ZCln8pg= github.com/nextapps-de/flexsearch v0.0.0-20240108021025-afd75f742f22 h1:re7L8FxbXQpnX8BgzkdUnDpsUmloGNyLmiy2ZCln8pg=

View File

@@ -2,7 +2,6 @@
"htmlElements": { "htmlElements": {
"tags": [ "tags": [
"a", "a",
"annotation",
"body", "body",
"button", "button",
"div", "div",
@@ -16,29 +15,13 @@
"label", "label",
"li", "li",
"link", "link",
"math",
"meta", "meta",
"mfrac",
"mi",
"mn",
"mo",
"mpadded",
"mphantom",
"mrow",
"mspace",
"msqrt",
"mstyle",
"msub",
"msup",
"mtext",
"munder",
"nav", "nav",
"noscript", "noscript",
"ol", "ol",
"p", "p",
"path", "path",
"script", "script",
"semantics",
"small", "small",
"span", "span",
"strong", "strong",
@@ -76,12 +59,10 @@
"col-6", "col-6",
"col-lg-2", "col-lg-2",
"col-lg-8", "col-lg-8",
"col-md-2",
"col-md-3", "col-md-3",
"col-md-4", "col-md-4",
"col-md-8", "col-md-8",
"col-md-9", "col-md-9",
"col-sm-12",
"collapse", "collapse",
"collapsed", "collapsed",
"container-fluid", "container-fluid",
@@ -92,16 +73,14 @@
"d-md-block", "d-md-block",
"d-md-none", "d-md-none",
"d-none", "d-none",
"display-1",
"display-4", "display-4",
"emphasis", "emphasis",
"end-0", "end-0",
"fa",
"fa-10x",
"fa-2x", "fa-2x",
"fa-arrow-left",
"fa-arrow-right",
"fa-book-open", "fa-book-open",
"fa-ellipsis", "fa-ellipsis",
"fa-face-frown",
"fa-facebook", "fa-facebook",
"fa-fw", "fa-fw",
"fa-github", "fa-github",
@@ -137,7 +116,6 @@
"justify-content-center", "justify-content-center",
"justify-content-end", "justify-content-end",
"justify-content-start", "justify-content-start",
"katex",
"label", "label",
"lead", "lead",
"link-bg-footer", "link-bg-footer",
@@ -145,7 +123,6 @@
"main-content", "main-content",
"main-nav-toggler", "main-nav-toggler",
"mb-3", "mb-3",
"mb-4",
"mb-5", "mb-5",
"mb-lg-5", "mb-lg-5",
"me-auto", "me-auto",
@@ -172,6 +149,7 @@
"navbar-mode-selector", "navbar-mode-selector",
"navbar-nav", "navbar-nav",
"navbar-toggler", "navbar-toggler",
"next",
"no-js", "no-js",
"offcanvas", "offcanvas",
"offcanvas-body", "offcanvas-body",
@@ -186,11 +164,13 @@
"p-2", "p-2",
"p-3", "p-3",
"p-4", "p-4",
"p-auto",
"pb-4", "pb-4",
"pb-5", "pb-5",
"pb-md-0", "pb-md-0",
"position-fixed", "position-fixed",
"position-relative", "position-relative",
"previous",
"ps-1", "ps-1",
"pt-5", "pt-5",
"pt-md-3", "pt-md-3",
@@ -205,7 +185,6 @@
"row-cols-md-2", "row-cols-md-2",
"row-cols-md-3", "row-cols-md-3",
"row-cols-sm-2", "row-cols-sm-2",
"row-cols-sm-3",
"search", "search",
"search-input", "search-input",
"search-suggestions", "search-suggestions",
@@ -219,7 +198,6 @@
"text-decoration-none", "text-decoration-none",
"text-end", "text-end",
"text-muted", "text-muted",
"text-secondary",
"text-sm-start", "text-sm-start",
"text-start", "text-start",
"text-uppercase", "text-uppercase",
@@ -233,7 +211,6 @@
"top-bar" "top-bar"
], ],
"ids": [ "ids": [
"blogs",
"btn-webshare", "btn-webshare",
"navbar-0-collapse", "navbar-0-collapse",
"navbar-mode", "navbar-mode",

View File

@@ -1,8 +1,10 @@
{{ if gt (findRE `^HAHAHUGO` .Destination 1) 0 }} {{ if gt (findRE `^HAHAHUGO` .Destination 1) 0 }}
{{ errorf "Invalid markdown link destination, use '%s' syntax when using shortcodes as input. See '%s'" {{ errorf "Invalid markdown link destination, use '%s' syntax when using shortcodes as input. See '%s'"
("{{% %}}" | htmlUnescape) ("{{% %}}" | htmlUnescape)
.Page.File.Filename .Page.File.Path
}} }}
{{ else if not .Destination }}
{{ errorf "Missing markdown link destination, see '%s'" .Page.File.Path }}
{{ else }} {{ else }}
{{ partial "assets/link.html" (dict {{ partial "assets/link.html" (dict
"destination" .Destination "destination" .Destination
@@ -10,4 +12,4 @@
"text" .Text "text" .Text
"title" .Title "title" .Title
) }} ) }}
{{ end }} {{- end }}

View File

@@ -51,9 +51,13 @@
<!-- Override arguments --> <!-- Override arguments -->
{{- $page := "" }} {{- $page := "" }}
{{- if .path }} {{- if .path }}
{{- $page = site.GetPage .path }} {{ $page = partial "utilities/GetPage.html" (dict "url" .path "page" page) }}
{{- if not $page }} {{- if not $page }}
{{- errorf "partial [assets/card.html] - Cannot find page: %s" .path -}} {{ if page.File }}
{{- errorf "partial [assets/card.html] - Cannot find target page '%s', see '%s'" .path page.File.Path -}}
{{ else }}
{{- errorf "partial [assets/card.html] - Cannot find target page '%s'" .path -}}
{{ end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- with $page -}} {{- with $page -}}

View File

@@ -22,6 +22,7 @@
{{- $cue := .cue | default site.Params.main.externalLinks.cue -}} {{- $cue := .cue | default site.Params.main.externalLinks.cue -}}
{{- $tab := .tab | default site.Params.main.externalLinks.tab -}} {{- $tab := .tab | default site.Params.main.externalLinks.tab -}}
{{- $isExternal := or (ne (urls.Parse (absURL $destination)).Host (urls.Parse site.BaseURL).Host) $external -}} {{- $isExternal := or (ne (urls.Parse (absURL $destination)).Host (urls.Parse site.BaseURL).Host) $external -}}
{{- $isLocal := hasPrefix $destination "#" -}}
{{- $page := .page -}} {{- $page := .page -}}
{{- $anchor := "" -}} {{- $anchor := "" -}}
{{- $text := .text -}} {{- $text := .text -}}
@@ -54,6 +55,7 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ if not $isLocal }}
{{ $ref := partial "utilities/GetPage.html" (dict "url" $destination "page" $page) }} {{ $ref := partial "utilities/GetPage.html" (dict "url" $destination "page" $page) }}
{{- if not $ref -}} {{- if not $ref -}}
{{- errorf "partial [assets/link.html] - Cannot find page: %s" $destination -}} {{- errorf "partial [assets/link.html] - Cannot find page: %s" $destination -}}
@@ -61,25 +63,29 @@
{{- else -}} {{- else -}}
{{- $destination = $ref.RelPermalink -}} {{- $destination = $ref.RelPermalink -}}
{{- with $anchor }}{{ $destination = printf "%s#%s" (strings.TrimSuffix "/" $destination) . -}}{{ end -}} {{- with $anchor }}{{ $destination = printf "%s#%s" (strings.TrimSuffix "/" $destination) . -}}{{ end -}}
{{- end -}}
{{- if not $text -}} {{- if not $text -}}
{{- if $anchor -}} {{ if $anchor }}{{ $text = $anchor }}{{ else }}{{ $text = $ref.LinkTitle }}{{ end }}
{{- $text = $anchor -}}
{{- else -}}
{{- $text = $ref.LinkTitle -}}
{{- end -}}
{{ end -}} {{ end -}}
{{ else }}
{{ with $anchor }}
{{ $destination = printf "#%s" . }}
{{ if not $text }}{{ $text = . }}{{ end }}
{{ end }}
{{ end }}
{{- if not $case }}{{ $text = lower $text }}{{ end -}} {{- if not $case }}{{ $text = lower $text }}{{ end -}}
{{- end -}}
{{- end -}} {{- end -}}
{{ if not $error -}} {{ if not $error -}}
<a <a
{{- with $destination }} href="{{ . | safeURL }}"{{ end -}} {{- with $destination }} href="{{ . | safeURL }}"{{ end -}}
{{- with $class }}class="{{ . }}" {{ end -}} {{ with $class }} class="{{ . }}" {{ end -}}
{{- with $target }} target="{{ . }}"{{ end -}} {{ with $target }} target="{{ . }}"{{ end -}}
{{- with $rel }} rel="{{ . }}"{{ end -}} {{ with $rel }} rel="{{ . }}"{{ end -}}
{{- with $title }} title="{{ . }}"{{ end -}} {{ with $title }} title="{{ . }}"{{ end -}}
> >
{{- $text -}} {{- $text | safeHTML -}}
</a> </a>
{{- end }} {{- end -}}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.26.0", "version": "0.26.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.26.0", "version": "0.26.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@fullhuman/postcss-purgecss": "^6.0.0", "@fullhuman/postcss-purgecss": "^6.0.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.26.0", "version": "0.26.1",
"description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator", "description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator",
"keywords": [ "keywords": [
"hugo", "hugo",