From 233251b06a3b51ac0c309cf9ed0ab148a0496259 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 13 Sep 2016 09:11:08 -0700 Subject: [PATCH] doc: journal: clarify D directive Example added, per #399 discussion. --- hledger-lib/doc/hledger_journal.5 | 23 +++++++++++++----- hledger-lib/doc/hledger_journal.5.info | 31 ++++++++++++++++--------- hledger-lib/doc/hledger_journal.5.m4.md | 17 ++++++++++---- hledger-lib/doc/hledger_journal.5.txt | 18 ++++++++++---- 4 files changed, 63 insertions(+), 26 deletions(-) diff --git a/hledger-lib/doc/hledger_journal.5 b/hledger-lib/doc/hledger_journal.5 index a73d8af38..59ad12e4c 100644 --- a/hledger-lib/doc/hledger_journal.5 +++ b/hledger-lib/doc/hledger_journal.5 @@ -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 diff --git a/hledger-lib/doc/hledger_journal.5.info b/hledger-lib/doc/hledger_journal.5.info index 20155cbcf..6c3d5d2ec 100644 --- a/hledger-lib/doc/hledger_journal.5.info +++ b/hledger-lib/doc/hledger_journal.5.info @@ -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 diff --git a/hledger-lib/doc/hledger_journal.5.m4.md b/hledger-lib/doc/hledger_journal.5.m4.md index 62ef339d0..50c302df2 100644 --- a/hledger-lib/doc/hledger_journal.5.m4.md +++ b/hledger-lib/doc/hledger_journal.5.m4.md @@ -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 diff --git a/hledger-lib/doc/hledger_journal.5.txt b/hledger-lib/doc/hledger_journal.5.txt index 1e00e6843..7a488ba84 100644 --- a/hledger-lib/doc/hledger_journal.5.txt +++ b/hledger-lib/doc/hledger_journal.5.txt @@ -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