doc: make periodic txn example more robust; motivate 2 space rule

This commit is contained in:
Simon Michael 2019-01-14 15:36:22 -08:00
parent e99f80d374
commit 40dc9b1db5

View File

@ -1111,18 +1111,18 @@ Partial or relative dates (M/D, D, tomorrow, last week) in the period expression
can work (useful or not). They will be relative to today's date, unless can work (useful or not). They will be relative to today's date, unless
a Y default year directive is in effect, in which case they will be relative to Y/1/1. a Y default year directive is in effect, in which case they will be relative to Y/1/1.
Period expressions must be terminated by **two or more spaces** if ### Two spaces after the period expression
followed by additional fields. For example, the periodic transaction given
below includes a transaction description "paycheck", which is separated If the period expression is followed by a transaction description,
from the period expression by a double space. If not for the second space, these must be separated by **two or more spaces**.
hledger would attempt (and fail) to parse "paycheck" as a part of the This helps hledger know where the period expression ends, so that descriptions
period expression. can not accidentally alter their meaning, as in this example:
``` ```
; 2 or more spaces ; 2 or more spaces needed here, so the period is not understood as "every 2 months in 2020"
; || ; ||
; vv ; vv
~ every 2 weeks from 2018/6/4 to 2018/9 paycheck ~ every 2 months in 2020, we will review
assets:bank:checking $1500 assets:bank:checking $1500
income:acme inc income:acme inc
``` ```