diff options
Diffstat (limited to 'app/Issue/Meta.hs')
-rw-r--r-- | app/Issue/Meta.hs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/app/Issue/Meta.hs b/app/Issue/Meta.hs index 19ccab3..6e3bbf0 100644 --- a/app/Issue/Meta.hs +++ b/app/Issue/Meta.hs @@ -4,8 +4,13 @@ module Issue.Meta ) where +import Data.List (intersperse) +import Data.Text qualified as T import Issue (Issue (..)) -import Issue.Tag (Tag, tagValue) +import Issue.Render () +import Issue.Tag (Tag, TagKey (..), tagValue) +import Render ((<<<)) +import Render qualified as P data Meta = Meta { referencedBy :: [(Issue, Tag)] @@ -24,3 +29,20 @@ getMeta issues issue = ) issues } + +instance P.Render Meta where + render meta = + if (not $ null meta.referencedBy) + then + P.styled [P.italicized] + . (P.vsep . intersperse P.hardline) + $ map + ( \(otherIssue, tag) -> + ("This commit was referenced by issue " :: T.Text) + <<< P.Linked otherIssue + <<< (" (" :: T.Text) + <<< TagKey tag + <<< (")." :: T.Text) + ) + meta.referencedBy + else P.emptyDoc |