doc: journal: clarify D directive

Example added, per #399 discussion.
This commit is contained in:
Simon Michael 2016-09-13 09:11:08 -07:00
parent 55bc2e3e38
commit 233251b06a
4 changed files with 63 additions and 26 deletions

View File

@ -803,12 +803,23 @@ commodity\ INR
.fi
.SS Default commodity
.PP
You can set a default commodity, to be used for amounts without one.
Use the D directive with a sample amount.
The commodity (and the sample amount\[aq]s display format) will be
applied to all subsequent commodity\-less amounts, up to the next D
directive.
(Note this is different from Ledger\[aq]s default commodity directive.)
The D directive sets a default commodity (and display format), to be
used for amounts without a commodity symbol (ie, plain numbers).
(Note this differs from Ledger\[aq]s default commodity directive.) The
commodity and display format will be applied to all subsequent
commodity\-less amounts, or until the next D directive.
.IP
.nf
\f[C]
#\ commodity\-less\ amounts\ should\ be\ treated\ as\ dollars
#\ (and\ displayed\ with\ symbol\ on\ the\ left,\ thousands\ separators\ and\ two\ decimal\ places)
D\ $1,000.00
1/1
\ \ a\ \ \ \ \ 5\ \ \ \ #\ <\-\ commodity\-less\ amount,\ becomes\ $1
\ \ b
\f[]
.fi
.SS Default year
.PP
You can set a default year to be used for subsequent dates which

View File

@ -841,11 +841,20 @@ File: hledger_journal.5.info, Node: Default commodity, Next: Default year, Pr
1.10.6 Default commodity
------------------------
You can set a default commodity, to be used for amounts without one. Use
the D directive with a sample amount. The commodity (and the sample
amount's display format) will be applied to all subsequent
commodity-less amounts, up to the next D directive. (Note this is
different from Ledger's default commodity directive.)
The D directive sets a default commodity (and display format), to be
used for amounts without a commodity symbol (ie, plain numbers). (Note
this differs from Ledger's default commodity directive.) The commodity
and display format will be applied to all subsequent commodity-less
amounts, or until the next D directive.
# commodity-less amounts should be treated as dollars
# (and displayed with symbol on the left, thousands separators and two decimal places)
D $1,000.00
1/1
a 5 # <- commodity-less amount, becomes $1
b

File: hledger_journal.5.info, Node: Default year, Next: Including other files, Prev: Default commodity, Up: Directives
@ -976,11 +985,11 @@ Node: commodity directive26543
Ref: #commodity-directive26729
Node: Default commodity27602
Ref: #default-commodity27777
Node: Default year28098
Ref: #default-year28265
Node: Including other files28688
Ref: #including-other-files28847
Node: EDITOR SUPPORT29243
Ref: #editor-support29363
Node: Default year28313
Ref: #default-year28480
Node: Including other files28903
Ref: #including-other-files29062
Node: EDITOR SUPPORT29458
Ref: #editor-support29578

End Tag Table

View File

@ -661,10 +661,19 @@ commodity INR
### Default commodity
You can set a default commodity, to be used for amounts without one.
Use the D directive with a sample amount.
The commodity (and the sample amount's display format) will be applied to all subsequent commodity-less amounts, up to the next D directive.
(Note this is different from Ledger's default commodity directive.)
The D directive sets a default commodity (and display format), to be used for amounts without a commodity symbol (ie, plain numbers).
(Note this differs from Ledger's default commodity directive.)
The commodity and display format will be applied to all subsequent commodity-less amounts, or until the next D directive.
```journal
# commodity-less amounts should be treated as dollars
# (and displayed with symbol on the left, thousands separators and two decimal places)
D $1,000.00
1/1
a 5 # <- commodity-less amount, becomes $1
b
```
### Default year

View File

@ -605,11 +605,19 @@ FILE FORMAT
format INR 9,99,99,999.00
Default commodity
You can set a default commodity, to be used for amounts without one.
Use the D directive with a sample amount. The commodity (and the sam-
ple amount's display format) will be applied to all subsequent commod-
ity-less amounts, up to the next D directive. (Note this is different
from Ledger's default commodity directive.)
The D directive sets a default commodity (and display format), to be
used for amounts without a commodity symbol (ie, plain numbers). (Note
this differs from Ledger's default commodity directive.) The commodity
and display format will be applied to all subsequent commodity-less
amounts, or until the next D directive.
# commodity-less amounts should be treated as dollars
# (and displayed with symbol on the left, thousands separators and two decimal places)
D $1,000.00
1/1
a 5 # <- commodity-less amount, becomes $1
b
Default year
You can set a default year to be used for subsequent dates which don't