Add links to URI-valued tags

This commit is contained in:
Saku Laesvuori 2026-01-22 10:34:48 +02:00
parent 040cd7a680
commit d387b7c2ab
2 changed files with 10 additions and 2 deletions

View File

@ -8,6 +8,7 @@
module Hledger.Web.Handler.JournalR where
import qualified Data.Text as T -- for journal.hamlet
import qualified Text.URI as URI
import Hledger
import Hledger.Cli.CliOptions
@ -36,6 +37,7 @@ getJournalR = do
transactionFrag = transactionFragment j
isVisibleTag = not . isHiddenTagName . fst
isPostingTag account tag = not $ tag `elem` journalInheritedAccountTags j account
isAbsoluteURI = maybe False URI.isPathAbsolute . URI.mkURI
defaultLayout $ do
setTitle "päiväkirja - hledger-web"

View File

@ -43,7 +43,10 @@ $if elem AddPermission perms
#{tagName}
$if not $ T.null $ T.strip tagValue
<div .tag-value>
#{tagValue}
$if isAbsoluteURI tagValue
<a href="#{tagValue}">#{tagValue}
$else
#{tagValue}
<ul .postings>
$forall Posting { paccount = acc, pamount = amt, ptags = tags } <- tpostings torig
@ -63,7 +66,10 @@ $if elem AddPermission perms
#{tagName}
$if not $ T.null $ T.strip tagValue
<div .tag-value>
#{tagValue}
$if isAbsoluteURI tagValue
<a href="#{tagValue}">#{tagValue}
$else
#{tagValue}
$if elem AddPermission perms
^{addModal AddR j today}