doc: clarify tags
[ci skip]
This commit is contained in:
parent
91dbeedee4
commit
9759b5c867
@ -613,30 +613,57 @@ end\ comment
|
|||||||
.fi
|
.fi
|
||||||
.SS Tags
|
.SS Tags
|
||||||
.PP
|
.PP
|
||||||
A \f[I]tag\f[] is a word followed by a full colon inside a transaction
|
Tags are a way to add extra labels or labelled data to postings and
|
||||||
or posting comment.
|
transactions, which you can then search or pivot on.
|
||||||
You can write multiple tags, comma separated.
|
|
||||||
Eg: \f[C];\ a\ comment\ containing\ sometag:,\ anothertag:\f[].
|
|
||||||
.PD 0
|
|
||||||
.P
|
|
||||||
.PD
|
|
||||||
You can search for tags with the \f[C]tag:\f[] query, or pivot on them
|
|
||||||
with \f[C]\-\-pivot\ TAG\f[].
|
|
||||||
.PP
|
.PP
|
||||||
A tag can also have a value, which is any text between the colon and the
|
A simple tag is a word (which may contain hyphens) followed by a full
|
||||||
next comma or newline, excluding leading/trailing whitespace.
|
colon, written inside a transaction or posting comment line:
|
||||||
(So hledger tag values can not contain commas or newlines).
|
.IP
|
||||||
|
.nf
|
||||||
|
\f[C]
|
||||||
|
2017/1/16\ bought\ groceries\ \ \ \ ;\ sometag:
|
||||||
|
\f[]
|
||||||
|
.fi
|
||||||
|
.PP
|
||||||
|
Tags can have a value, which is the text after the colon, up to the next
|
||||||
|
comma or end of line, with leading/trailing whitespace removed:
|
||||||
|
.IP
|
||||||
|
.nf
|
||||||
|
\f[C]
|
||||||
|
\ \ \ \ expenses:food\ \ \ \ $10\ \ \ ;\ a\-posting\-tag:\ the\ tag\ value
|
||||||
|
\f[]
|
||||||
|
.fi
|
||||||
|
.PP
|
||||||
|
Note this means hledger\[aq]s tag values can not contain commas or
|
||||||
|
newlines.
|
||||||
|
Ending at commas means you can write multiple short tags on one line,
|
||||||
|
comma separated:
|
||||||
|
.IP
|
||||||
|
.nf
|
||||||
|
\f[C]
|
||||||
|
\ \ \ \ assets:checking\ \ \ \ \ \ \ ;\ a\ comment\ containing\ tag1:,\ tag2:\ some\ value\ ...
|
||||||
|
\f[]
|
||||||
|
.fi
|
||||||
|
.PP
|
||||||
|
Here,
|
||||||
|
.IP \[bu] 2
|
||||||
|
"\f[C]a\ comment\ containing\f[]" is just comment text, not a tag
|
||||||
|
.IP \[bu] 2
|
||||||
|
"\f[C]tag1\f[]" is a tag with no value
|
||||||
|
.IP \[bu] 2
|
||||||
|
"\f[C]tag2\f[]" is another tag, whose value is
|
||||||
|
"\f[C]some\ value\ ...\f[]"
|
||||||
.PP
|
.PP
|
||||||
Tags in a transaction comment affect the transaction and all of its
|
Tags in a transaction comment affect the transaction and all of its
|
||||||
postings, while tags in a posting comment affect only that posting.
|
postings, while tags in a posting comment affect only that posting.
|
||||||
For example, the following transaction has three tags (A, TAG2,
|
For example, the following transaction has three tags (\f[C]A\f[],
|
||||||
third\-tag) and the posting has four (A, TAG2, third\-tag,
|
\f[C]TAG2\f[], \f[C]third\-tag\f[]) and the posting has four (those plus
|
||||||
posting\-tag):
|
\f[C]posting\-tag\f[]):
|
||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
\f[C]
|
\f[C]
|
||||||
1/1\ a\ transaction\ \ ;\ A:,\ TAG2:
|
1/1\ a\ transaction\ \ ;\ A:,\ TAG2:
|
||||||
\ \ \ \ ;\ third\-tag:\ a\ third\ transaction\ tag,\ this\ time\ with\ a\ value
|
\ \ \ \ ;\ third\-tag:\ a\ third\ transaction\ tag,\ <\-\ with\ a\ value
|
||||||
\ \ \ \ (a)\ \ $1\ \ ;\ posting\-tag:
|
\ \ \ \ (a)\ \ $1\ \ ;\ posting\-tag:
|
||||||
\f[]
|
\f[]
|
||||||
.fi
|
.fi
|
||||||
|
|||||||
@ -638,24 +638,44 @@ File: hledger_journal.5.info, Node: Tags, Next: Directives, Prev: Comments,
|
|||||||
1.10 Tags
|
1.10 Tags
|
||||||
=========
|
=========
|
||||||
|
|
||||||
A _tag_ is a word followed by a full colon inside a transaction or
|
Tags are a way to add extra labels or labelled data to postings and
|
||||||
posting comment. You can write multiple tags, comma separated. Eg: `; a
|
transactions, which you can then search or pivot on.
|
||||||
comment containing sometag:, anothertag:'.
|
|
||||||
You can search for tags with the `tag:' query, or pivot on them with
|
|
||||||
`--pivot TAG'.
|
|
||||||
|
|
||||||
A tag can also have a value, which is any text between the colon and
|
A simple tag is a word (which may contain hyphens) followed by a full
|
||||||
the next comma or newline, excluding leading/trailing whitespace. (So
|
colon, written inside a transaction or posting comment line:
|
||||||
hledger tag values can not contain commas or newlines).
|
|
||||||
|
|
||||||
|
2017/1/16 bought groceries ; sometag:
|
||||||
|
|
||||||
|
Tags can have a value, which is the text after the colon, up to the
|
||||||
|
next comma or end of line, with leading/trailing whitespace removed:
|
||||||
|
|
||||||
|
|
||||||
|
expenses:food $10 ; a-posting-tag: the tag value
|
||||||
|
|
||||||
|
Note this means hledger's tag values can not contain commas or
|
||||||
|
newlines. Ending at commas means you can write multiple short tags on
|
||||||
|
one line, comma separated:
|
||||||
|
|
||||||
|
|
||||||
|
assets:checking ; a comment containing tag1:, tag2: some value ...
|
||||||
|
|
||||||
|
Here,
|
||||||
|
|
||||||
|
* "`a comment containing'" is just comment text, not a tag
|
||||||
|
|
||||||
|
* "`tag1'" is a tag with no value
|
||||||
|
|
||||||
|
* "`tag2'" is another tag, whose value is "`some value ...'"
|
||||||
|
|
||||||
Tags in a transaction comment affect the transaction and all of its
|
Tags in a transaction comment affect the transaction and all of its
|
||||||
postings, while tags in a posting comment affect only that posting. For
|
postings, while tags in a posting comment affect only that posting. For
|
||||||
example, the following transaction has three tags (A, TAG2, third-tag)
|
example, the following transaction has three tags (`A', `TAG2',
|
||||||
and the posting has four (A, TAG2, third-tag, posting-tag):
|
`third-tag') and the posting has four (those plus `posting-tag'):
|
||||||
|
|
||||||
|
|
||||||
1/1 a transaction ; A:, TAG2:
|
1/1 a transaction ; A:, TAG2:
|
||||||
; third-tag: a third transaction tag, this time with a value
|
; third-tag: a third transaction tag, <- with a value
|
||||||
(a) $1 ; posting-tag:
|
(a) $1 ; posting-tag:
|
||||||
|
|
||||||
Tags are like Ledger's metadata feature, except hledger's tag values
|
Tags are like Ledger's metadata feature, except hledger's tag values
|
||||||
@ -1051,35 +1071,35 @@ Node: Comments21085
|
|||||||
Ref: #comments21207
|
Ref: #comments21207
|
||||||
Node: Tags22319
|
Node: Tags22319
|
||||||
Ref: #tags22439
|
Ref: #tags22439
|
||||||
Node: Implicit tags23427
|
Node: Implicit tags23874
|
||||||
Ref: #implicit-tags23535
|
Ref: #implicit-tags23982
|
||||||
Node: Directives24054
|
Node: Directives24501
|
||||||
Ref: #directives24169
|
Ref: #directives24616
|
||||||
Node: Account aliases24362
|
Node: Account aliases24809
|
||||||
Ref: #account-aliases24508
|
Ref: #account-aliases24955
|
||||||
Node: Basic aliases25110
|
Node: Basic aliases25557
|
||||||
Ref: #basic-aliases25255
|
Ref: #basic-aliases25702
|
||||||
Node: Regex aliases25943
|
Node: Regex aliases26390
|
||||||
Ref: #regex-aliases26113
|
Ref: #regex-aliases26560
|
||||||
Node: Multiple aliases26883
|
Node: Multiple aliases27330
|
||||||
Ref: #multiple-aliases27057
|
Ref: #multiple-aliases27504
|
||||||
Node: end aliases27553
|
Node: end aliases28000
|
||||||
Ref: #end-aliases27695
|
Ref: #end-aliases28142
|
||||||
Node: account directive27797
|
Node: account directive28244
|
||||||
Ref: #account-directive27979
|
Ref: #account-directive28426
|
||||||
Node: apply account directive28275
|
Node: apply account directive28722
|
||||||
Ref: #apply-account-directive28473
|
Ref: #apply-account-directive28920
|
||||||
Node: Multi-line comments29133
|
Node: Multi-line comments29580
|
||||||
Ref: #multi-line-comments29325
|
Ref: #multi-line-comments29772
|
||||||
Node: commodity directive29452
|
Node: commodity directive29899
|
||||||
Ref: #commodity-directive29638
|
Ref: #commodity-directive30085
|
||||||
Node: Default commodity30511
|
Node: Default commodity30958
|
||||||
Ref: #default-commodity30686
|
Ref: #default-commodity31133
|
||||||
Node: Default year31222
|
Node: Default year31669
|
||||||
Ref: #default-year31389
|
Ref: #default-year31836
|
||||||
Node: Including other files31812
|
Node: Including other files32259
|
||||||
Ref: #including-other-files31971
|
Ref: #including-other-files32418
|
||||||
Node: EDITOR SUPPORT32367
|
Node: EDITOR SUPPORT32814
|
||||||
Ref: #editor-support32487
|
Ref: #editor-support32934
|
||||||
|
|
||||||
End Tag Table
|
End Tag Table
|
||||||
|
|||||||
@ -502,24 +502,39 @@ end comment
|
|||||||
|
|
||||||
## Tags
|
## Tags
|
||||||
|
|
||||||
A *tag* is a word followed by a full colon inside a transaction or
|
Tags are a way to add extra labels or labelled data to postings and transactions,
|
||||||
posting [comment](#comments). You can write multiple tags, comma
|
which you can then [search](/journal.html#queries) or [pivot](/hledger.html#pivoting) on.
|
||||||
separated. Eg: `; a comment containing sometag:, anothertag:`.
|
|
||||||
You can search for tags with the [`tag:` query](/hledger.html#queries),
|
|
||||||
or pivot on them with [`--pivot TAG`](/hledger.html#pivoting).
|
|
||||||
|
|
||||||
A tag can also have a value, which is any text between the colon and
|
A simple tag is a word (which may contain hyphens) followed by a full colon,
|
||||||
the next comma or newline, excluding leading/trailing whitespace.
|
written inside a transaction or posting [comment](#comments) line:
|
||||||
(So hledger tag values can not contain commas or newlines).
|
```journal
|
||||||
|
2017/1/16 bought groceries ; sometag:
|
||||||
|
```
|
||||||
|
|
||||||
|
Tags can have a value, which is the text after the colon, up to the next comma or end of line, with leading/trailing whitespace removed:
|
||||||
|
```journal
|
||||||
|
expenses:food $10 ; a-posting-tag: the tag value
|
||||||
|
```
|
||||||
|
|
||||||
|
Note this means hledger's tag values can not contain commas or newlines.
|
||||||
|
Ending at commas means you can write multiple short tags on one line, comma separated:
|
||||||
|
```journal
|
||||||
|
assets:checking ; a comment containing tag1:, tag2: some value ...
|
||||||
|
```
|
||||||
|
Here,
|
||||||
|
|
||||||
|
- "`a comment containing `" is just comment text, not a tag
|
||||||
|
- "`tag1`" is a tag with no value
|
||||||
|
- "`tag2`" is another tag, whose value is "`some value ...`"
|
||||||
|
|
||||||
Tags in a transaction comment affect the transaction and all of its postings,
|
Tags in a transaction comment affect the transaction and all of its postings,
|
||||||
while tags in a posting comment affect only that posting.
|
while tags in a posting comment affect only that posting.
|
||||||
For example, the following transaction has three tags (A, TAG2, third-tag)
|
For example, the following transaction has three tags (`A`, `TAG2`, `third-tag`)
|
||||||
and the posting has four (A, TAG2, third-tag, posting-tag):
|
and the posting has four (those plus `posting-tag`):
|
||||||
|
|
||||||
```journal
|
```journal
|
||||||
1/1 a transaction ; A:, TAG2:
|
1/1 a transaction ; A:, TAG2:
|
||||||
; third-tag: a third transaction tag, this time with a value
|
; third-tag: a third transaction tag, <- with a value
|
||||||
(a) $1 ; posting-tag:
|
(a) $1 ; posting-tag:
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -468,23 +468,40 @@ FILE FORMAT
|
|||||||
; a journal comment (because not indented)
|
; a journal comment (because not indented)
|
||||||
|
|
||||||
Tags
|
Tags
|
||||||
A tag is a word followed by a full colon inside a transaction or post-
|
Tags are a way to add extra labels or labelled data to postings and
|
||||||
ing comment. You can write multiple tags, comma separated. Eg:
|
transactions, which you can then search or pivot on.
|
||||||
; a comment containing sometag:, anothertag:.
|
|
||||||
You can search for tags with the tag: query, or pivot on them with
|
|
||||||
--pivot TAG.
|
|
||||||
|
|
||||||
A tag can also have a value, which is any text between the colon and
|
A simple tag is a word (which may contain hyphens) followed by a full
|
||||||
the next comma or newline, excluding leading/trailing whitespace. (So
|
colon, written inside a transaction or posting comment line:
|
||||||
hledger tag values can not contain commas or newlines).
|
|
||||||
|
2017/1/16 bought groceries ; sometag:
|
||||||
|
|
||||||
|
Tags can have a value, which is the text after the colon, up to the
|
||||||
|
next comma or end of line, with leading/trailing whitespace removed:
|
||||||
|
|
||||||
|
expenses:food $10 ; a-posting-tag: the tag value
|
||||||
|
|
||||||
|
Note this means hledger's tag values can not contain commas or new-
|
||||||
|
lines. Ending at commas means you can write multiple short tags on one
|
||||||
|
line, comma separated:
|
||||||
|
|
||||||
|
assets:checking ; a comment containing tag1:, tag2: some value ...
|
||||||
|
|
||||||
|
Here,
|
||||||
|
|
||||||
|
o "a comment containing" is just comment text, not a tag
|
||||||
|
|
||||||
|
o "tag1" is a tag with no value
|
||||||
|
|
||||||
|
o "tag2" is another tag, whose value is "some value ..."
|
||||||
|
|
||||||
Tags in a transaction comment affect the transaction and all of its
|
Tags in a transaction comment affect the transaction and all of its
|
||||||
postings, while tags in a posting comment affect only that posting.
|
postings, while tags in a posting comment affect only that posting.
|
||||||
For example, the following transaction has three tags (A, TAG2,
|
For example, the following transaction has three tags (A, TAG2,
|
||||||
third-tag) and the posting has four (A, TAG2, third-tag, posting-tag):
|
third-tag) and the posting has four (those plus posting-tag):
|
||||||
|
|
||||||
1/1 a transaction ; A:, TAG2:
|
1/1 a transaction ; A:, TAG2:
|
||||||
; third-tag: a third transaction tag, this time with a value
|
; third-tag: a third transaction tag, <- with a value
|
||||||
(a) $1 ; posting-tag:
|
(a) $1 ; posting-tag:
|
||||||
|
|
||||||
Tags are like Ledger's metadata feature, except hledger's tag values
|
Tags are like Ledger's metadata feature, except hledger's tag values
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user