diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-03-19 20:19:29 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-02-25 20:03:28 -0400 |
commit | 54cad6287e26fd9b6f96716d42e2973cfc85aacd (patch) | |
tree | aca9bd8b1d5c7275eb23466b0a1352a1478178ab | |
parent | 987d4499e0d5791a222671b87f0817bdac1ac3be (diff) |
content: listArtTagNetwork: fix up "jump to" wrapping
-rw-r--r-- | src/content/dependencies/listArtTagNetwork.js | 38 | ||||
-rw-r--r-- | src/strings-default.yaml | 6 |
2 files changed, 21 insertions, 23 deletions
diff --git a/src/content/dependencies/listArtTagNetwork.js b/src/content/dependencies/listArtTagNetwork.js index f392e817..c975c07e 100644 --- a/src/content/dependencies/listArtTagNetwork.js +++ b/src/content/dependencies/listArtTagNetwork.js @@ -174,11 +174,24 @@ export default { generate(data, relations, {html, language}) { const prefix = `listingPage.listArtTags.network`; - const wrapTag = (dataNode, relationsNode) => [ + const wrapTagWithJumpTo = (dataNode, relationsNode, depth) => + (depth === 0 + ? relationsNode.artTagLink + : dataNode.representsRoot + ? language.$(prefix, 'tag.jumpToRoot', { + tag: + relationsNode.artTagLink.slots({ + anchor: true, + hash: dataNode.directory, + }), + }) + : relationsNode.artTagLink); + + const wrapTagWithStats = (dataNode, relationsNode, depth) => [ html.tag('span', {class: 'network-tag'}, language.$(prefix, 'tag', { tag: - relationsNode.artTagLink, + wrapTagWithJumpTo(dataNode, relationsNode, depth), })), html.tag('span', {class: 'network-tag'}, @@ -187,12 +200,7 @@ export default { language.$(prefix, 'tag.withStat', { tag: - (dataNode.representsRoot - ? relationsNode.artTagLink.slots({ - anchor: true, - hash: dataNode.directory, - }) - : relationsNode.artTagLink), + wrapTagWithJumpTo(dataNode, relationsNode, depth), stat: html.tag('span', {class: 'network-tag-stat'}, @@ -222,7 +230,7 @@ export default { ? (relationsNode.ancestorTagLinks ? language.$(prefix, 'root.withAncestors', { tag: - wrapTag(dataNode, relationsNode), + wrapTagWithStats(dataNode, relationsNode, depth), ancestors: language.formatUnitList( @@ -237,21 +245,13 @@ export default { }) : language.$(prefix, 'root.jumpToTop', { tag: - wrapTag(dataNode, relationsNode), + wrapTagWithStats(dataNode, relationsNode, depth), link: html.tag('a', {href: '#top'}, language.$(prefix, 'root.jumpToTop.link')), })) - : (dataNode.representsRoot - ? language.$(prefix, 'descendant.jumpToRoot', { - tag: - wrapTag(dataNode, relationsNode), - }) - : language.$(prefix, 'descendant', { - tag: - wrapTag(dataNode, relationsNode), - })))), + : wrapTagWithStats(dataNode, relationsNode, depth))), dataNode.descendantNodes && relationsNode.descendantNodes && diff --git a/src/strings-default.yaml b/src/strings-default.yaml index a56bacf2..0d86249a 100644 --- a/src/strings-default.yaml +++ b/src/strings-default.yaml @@ -1727,13 +1727,11 @@ listingPage: root.withAncestors: _: "{TAG} (descends from {ANCESTORS})" - descendant: - _: "{TAG}" - jumpToRoot: "Jump to: {TAG}" - tag: _: "{TAG}" + jumpToRoot: "Jump to: {TAG}" + withStat: _: "{STAT} {TAG}" stat: "({STAT})" |