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 .fi
.SS Default commodity .SS Default commodity
.PP .PP
You can set a default commodity, to be used for amounts without one. The D directive sets a default commodity (and display format), to be
Use the D directive with a sample amount. used for amounts without a commodity symbol (ie, plain numbers).
The commodity (and the sample amount\[aq]s display format) will be (Note this differs from Ledger\[aq]s default commodity directive.) The
applied to all subsequent commodity\-less amounts, up to the next D commodity and display format will be applied to all subsequent
directive. commodity\-less amounts, or until the next D directive.
(Note this is different from Ledger\[aq]s default commodity 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 .SS Default year
.PP .PP
You can set a default year to be used for subsequent dates which 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 1.10.6 Default commodity
------------------------ ------------------------
You can set a default commodity, to be used for amounts without one. Use The D directive sets a default commodity (and display format), to be
the D directive with a sample amount. The commodity (and the sample used for amounts without a commodity symbol (ie, plain numbers). (Note
amount's display format) will be applied to all subsequent this differs from Ledger's default commodity directive.) The commodity
commodity-less amounts, up to the next D directive. (Note this is and display format will be applied to all subsequent commodity-less
different from Ledger's default commodity directive.) 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 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 Ref: #commodity-directive26729
Node: Default commodity27602 Node: Default commodity27602
Ref: #default-commodity27777 Ref: #default-commodity27777
Node: Default year28098 Node: Default year28313
Ref: #default-year28265 Ref: #default-year28480
Node: Including other files28688 Node: Including other files28903
Ref: #including-other-files28847 Ref: #including-other-files29062
Node: EDITOR SUPPORT29243 Node: EDITOR SUPPORT29458
Ref: #editor-support29363 Ref: #editor-support29578
 
End Tag Table End Tag Table

View File

@ -661,10 +661,19 @@ commodity INR
### Default commodity ### Default commodity
You can set a default commodity, to be used for amounts without one. The D directive sets a default commodity (and display format), to be used for amounts without a commodity symbol (ie, plain numbers).
Use the D directive with a sample amount. (Note this differs from Ledger's default commodity directive.)
The commodity (and the sample amount's display format) will be applied to all subsequent commodity-less amounts, up to the next D directive. The commodity and display format will be applied to all subsequent commodity-less amounts, or until the next D directive.
(Note this is different from Ledger's default commodity 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 ### Default year

View File

@ -605,11 +605,19 @@ FILE FORMAT
format INR 9,99,99,999.00 format INR 9,99,99,999.00
Default commodity Default commodity
You can set a default commodity, to be used for amounts without one. The D directive sets a default commodity (and display format), to be
Use the D directive with a sample amount. The commodity (and the sam- used for amounts without a commodity symbol (ie, plain numbers). (Note
ple amount's display format) will be applied to all subsequent commod- this differs from Ledger's default commodity directive.) The commodity
ity-less amounts, up to the next D directive. (Note this is different and display format will be applied to all subsequent commodity-less
from Ledger's default commodity directive.) 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 Default year
You can set a default year to be used for subsequent dates which don't You can set a default year to be used for subsequent dates which don't