imp: auto-declare builtin tag names like type: and t: (#2119)

Now using type: in account declarations or generating t: with timedot
letters won't cause the `tags` check to fail.

If a user declares any of these explicitly with a tag directive,
it does not cause an error.
This commit is contained in:
Simon Michael 2023-12-07 08:55:05 -10:00
parent 6ae64c8f3e
commit c062b14c5d

View File

@ -186,7 +186,7 @@ journalCheckTags j = do
-- where
-- col = T.length (showTransactionLineFirstPart txn') + 2
-- col2 = col + T.length tagname - 1
declaredtags = journalTagsDeclared j
declaredtags = journalTagsDeclared j ++ builtinTags
msg = (unlines [
"%s:%d:"
,"%s"
@ -197,6 +197,19 @@ journalCheckTags j = do
,"tag %s"
])
-- | Tag names which have special significance to hledger.
builtinTags = [
"type" -- declares an account's type
,"t" -- generated by timedot letters notation
-- optionally generated on periodic transactions and auto postings
,"generated-transaction"
,"generated-posting"
-- used internally, not shown (but queryable)
,"_generated-transaction"
,"_generated-posting"
,"_conversion-matched"
]
-- | In each tranaction, check that any conversion postings occur in adjacent pairs.
journalCheckPairedConversionPostings :: Journal -> Either String ()
journalCheckPairedConversionPostings j =