From 5adfbb24c0002c5593efc3f826d16a9a4bdbdcf8 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sun, 17 Dec 2017 18:19:22 -0800 Subject: [PATCH] start converting the quickref to separate files An experimental plan for easier maintenance. There will be one linear quickref-NAME.md file per ledger-like, with similar headings and content across all quickref files. A script will take the sections and tabulate them nicely to give a layout like the current page. And perhaps there'll be some javascript to show/hide each format. --- Makefile | 4 +- quickref/quickref-beancount.html | 142 +++++++++++++++++++++ quickref/quickref-beancount.md | 153 +++++++++++++++++++++++ quickref/quickref-hledger.html | 117 ++++++++++++++++++ quickref/quickref-hledger.md | 124 +++++++++++++++++++ quickref/quickref-ledger.html | 174 ++++++++++++++++++++++++++ quickref/quickref-ledger.md | 205 +++++++++++++++++++++++++++++++ 7 files changed, 917 insertions(+), 2 deletions(-) create mode 100644 quickref/quickref-beancount.html create mode 100644 quickref/quickref-beancount.md create mode 100644 quickref/quickref-hledger.html create mode 100644 quickref/quickref-hledger.md create mode 100644 quickref/quickref-ledger.html create mode 100644 quickref/quickref-ledger.md diff --git a/Makefile b/Makefile index 092e831..673acc1 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ all: html # generate html from all md files -html: $(patsubst %.md,%.html,$(wildcard *.md)) Makefile +html: $(patsubst %.md,%.html,$(wildcard *.md quickref/*.md)) Makefile -PANDOC = pandoc +PANDOC=pandoc -f markdown+autolink_bare_uris # generate html from a md file %.html: %.md index.tmpl diff --git a/quickref/quickref-beancount.html b/quickref/quickref-beancount.html new file mode 100644 index 0000000..37f7683 --- /dev/null +++ b/quickref/quickref-beancount.html @@ -0,0 +1,142 @@ + + + + + + + Plain Text Accounting, a guide to Ledger and friends + + + + + + + + + + + + + + + + + + + + + +
+ +

Beancount

+

http://furius.ca/beancount/doc/syntax
+http://furius.ca/beancount/doc/cheatsheet

+

Basic example

+
; a comment
+
+2016-01-01 open Assets:Checking
+2016-01-01 open Equity:Opening-Balances
+2016-01-01 open Expenses:Groceries
+
+2016-01-01 txn "set opening balance"
+   Assets:Checking         500.00 USD
+   Equity:Opening-Balances
+
+2016-01-05 txn "farmer's market"
+   Expenses:Groceries     50 USD
+   Assets:Checking
+

All referenced accounts must have an open directive.

+

Comments

+
; comment
+

Any unrecognised line is also a comment

+

Basic transactions

+
DATE txn [["PAYEE"] "DESCRIPTION"]
+   ACCOUNT    AMOUNT
+   ACCOUNT    [AMOUNT]
+

DESCRIPTION must be in double quotes, can be multiline. No need for two spaces between account and amount.

+

Dates

+
YYYY-MM-DD
+YYYY/MM/DD
+YYYY.MM.DD
+

Only YYYY-MM-DD with 8 digits is officially supported.

+

Account names

+
TOPACCT[:SUBACCT[:...]]
+
+Income:Salary
+Liabilities:CreditCard:CITI-1234
+Assets:House
+

Top level account must be one of Assets, Liabilities, Equity, Income, Expenses. Each subaccount must be capitalised. Letters, digits and hyphen are allowed (no spaces).

+

Amounts

+
QUANTITY COMMODITY
+
+10USD
+1000.0001 USD
+

COMMODITY is all capital letters, on the right, and required . Decimal point is . (period). Digit group separator , (comma) is allowed and ignored.

+

More transaction features

+
DATE [txn|FLAG] [["PAYEE"] "DESCRIPTION"]
+   [FLAG] ACCOUNT       AMOUNT [PRICE]
+   ...
+   [FLAG] ACCOUNT       AMOUNT [PRICE]
+

The txn keyword may be replaced by a FLAG. For just a payee, use "PAYEE" "".

+

Prices

+

{LOTUNITPRICE[ / LOTDATE]} and/or one of @ UNITPRICE, @@ TOTALPRICE.

+

Lot prices are remembered and form distinct commodities, other prices are not. If there is both a lot price and a regular price, the latter records a market price.

+

Balance assertions

+
DATE balance ACCOUNT AMOUNT
+
+2014-08-09 balance Assets:Cash 562.00 USD
+2014-08-09 balance Assets:Cash 210.00 CAD
+

Asserts the balance in this commodity, in this account, including subaccounts, at the start of this day.

+

Balance assignments

+

Directives

+
[DATE] KEYWORD ARGS...
+   [SUBDIRECTIVES]
+
+DATE balance
+DATE close
+DATE commodity
+DATE document
+DATE event
+DATE note
+DATE open
+DATE pad
+DATE price
+DATE txn
+include
+option
+plugin
+poptag
+pushtag
+

account, open

+
DATE open ACCOUNT [COMMODITY[,...]] [METHOD]
+
+2014-05-01 open Assets:Cash USD,CAD
+

Every account posted to needs an open directive with prior date.

+

close

+
DATE close ACCOUNT
+

commodity

+
DATE commodity COMMODITY
+   [METADATA]
+
+1867-01-01 commodity CAD
+   name: "Canadian Dollar"
+   asset-class: "cash"
+

Attaches metadata to a commodity.

+

market price

+
DATE price COMMODITY AMOUNT
+
+2014-07-09 price USD  1.08 CAD
+

Also set by transaction prices.

+ +
+ + + + diff --git a/quickref/quickref-beancount.md b/quickref/quickref-beancount.md new file mode 100644 index 0000000..85e01bc --- /dev/null +++ b/quickref/quickref-beancount.md @@ -0,0 +1,153 @@ +# Beancount + +http://furius.ca/beancount/doc/syntax +http://furius.ca/beancount/doc/cheatsheet + +## Basic example + + ; a comment + + 2016-01-01 open Assets:Checking + 2016-01-01 open Equity:Opening-Balances + 2016-01-01 open Expenses:Groceries + + 2016-01-01 txn "set opening balance" + Assets:Checking 500.00 USD + Equity:Opening-Balances + + 2016-01-05 txn "farmer's market" + Expenses:Groceries 50 USD + Assets:Checking + +All referenced accounts must have an open directive. + +## Comments + + ; comment + +Any unrecognised line is also a comment + +## Basic transactions + + DATE txn [["PAYEE"] "DESCRIPTION"] + ACCOUNT AMOUNT + ACCOUNT [AMOUNT] + +DESCRIPTION must be in double quotes, can be multiline. +No need for two spaces between account and amount. + +## Dates + + YYYY-MM-DD + YYYY/MM/DD + YYYY.MM.DD + +Only YYYY-MM-DD with 8 digits is officially supported. + +## Account names + + TOPACCT[:SUBACCT[:...]] + + Income:Salary + Liabilities:CreditCard:CITI-1234 + Assets:House + +Top level account must be one of Assets, Liabilities, Equity, Income, Expenses. +Each subaccount must be capitalised. +Letters, digits and hyphen are allowed (no spaces). + +## Amounts + + QUANTITY COMMODITY + + 10USD + 1000.0001 USD + +COMMODITY is all capital letters, on the right, and required . +Decimal point is . (period). +Digit group separator , (comma) is allowed and ignored. + +## More transaction features + + DATE [txn|FLAG] [["PAYEE"] "DESCRIPTION"] + [FLAG] ACCOUNT AMOUNT [PRICE] + ... + [FLAG] ACCOUNT AMOUNT [PRICE] + +The txn keyword may be replaced by a FLAG. +For just a payee, use `"PAYEE" ""`. + +## Prices + +`{LOTUNITPRICE[ / LOTDATE]}` +and/or one of +`@ UNITPRICE`, +`@@ TOTALPRICE`. + +Lot prices are remembered and form distinct commodities, other prices are not. +If there is both a lot price and a regular price, the latter records a market price. + +## Balance assertions + + DATE balance ACCOUNT AMOUNT + + 2014-08-09 balance Assets:Cash 562.00 USD + 2014-08-09 balance Assets:Cash 210.00 CAD + +Asserts the balance in this commodity, +in this account, including subaccounts, +at the start of this day. + +## Balance assignments + +## Directives + + [DATE] KEYWORD ARGS... + [SUBDIRECTIVES] + + DATE balance + DATE close + DATE commodity + DATE document + DATE event + DATE note + DATE open + DATE pad + DATE price + DATE txn + include + option + plugin + poptag + pushtag + +## account, open + + DATE open ACCOUNT [COMMODITY[,...]] [METHOD] + + 2014-05-01 open Assets:Cash USD,CAD + +Every account posted to needs an open directive with prior date. + +## close + + DATE close ACCOUNT + +## commodity + + DATE commodity COMMODITY + [METADATA] + + 1867-01-01 commodity CAD + name: "Canadian Dollar" + asset-class: "cash" + +Attaches metadata to a commodity. + +## market price + + DATE price COMMODITY AMOUNT + + 2014-07-09 price USD 1.08 CAD + +Also set by transaction prices. diff --git a/quickref/quickref-hledger.html b/quickref/quickref-hledger.html new file mode 100644 index 0000000..0df1235 --- /dev/null +++ b/quickref/quickref-hledger.html @@ -0,0 +1,117 @@ + + + + + + + Plain Text Accounting, a guide to Ledger and friends + + + + + + + + + + + + + + + + + + + + + +
+ +

hledger

+

http://hledger.org/journal.html

+

Basic example

+
; a comment
+
+2016/1/1 set opening balance
+   assets:checking       $500.00
+   equity:opening balances
+
+2016/1/5 farmer's market
+   expenses:groceries     $50.00
+   assets:checking
+

Comments

+
; comment
+# comment
+* comment and org-mode outline node
+

Basic transactions

+
DATE [DESCRIPTION]
+   ACCOUNT    AMOUNT
+   ACCOUNT    [AMOUNT]
+

Non-comment lines may end with a comment. Indented comments are attached to the preceding transaction or posting.

+

Dates

+
YYYY-MM-DD
+YYYY/MM/DD
+YYYY.MM.DD
+MM-DD
+MM/DD
+MM.DD
+

Account names

+
TOPACCT[:SUBACCT[:...]]
+
+Revenues:Salary
+liabilities:credit card:CITI 1234
+other assets:house
+

Account names begin with a letter. May contain single spaces. May contain subaccounts separated by : (colon).

+

Amounts

+

One of COMMODITY QUANTITY, QUANTITY COMMODITY, QUANTITY.

+
10
+$10.00
+1,000.0001 USD
+10 "prepaid classes"
+1.000.000,01
+12,34,567.89
+

Decimal point is . or , (period or comma). Digit group separator is , or . (the one not used for decimal point). Any digit grouping can be used, not just thousands.

+

More transaction features

+
DATE [FLAG] [(CODE)] DESCRIPTION
+   [FLAG] ACCOUNT  AMOUNT [PRICE] [=BAL]
+   ...
+   [FLAG] ACCOUNT  AMOUNT [PRICE] [=BAL]
+

Prices

+

One of @ FIXEDUNITPRICE @@ FIXEDTOTALPRICE and/or {=FIXEDLOTUNITPRICE}.

+

These do not record market prices. The lot price syntax is ignored.

+

Balance assertions

+

= AMOUNT after posting amount & price.

+

Asserts the balance in this commodity, in this account, excluding subaccounts, on this day. Same day events are processed in parse order.

+

Balance assignments

+

Directives

+
KEYWORD ARGS...
+
+account (alias for apply)
+alias
+apply
+comment
+D
+end
+include
+

account, open

+

close

+

commodity

+

market price

+
P DATE [TIME] COMMODITY UNITPRICE
+
+P 2015/8/9 GBP $1.55
+

Used by -V. A time is ignored.

+ +
+ + + + diff --git a/quickref/quickref-hledger.md b/quickref/quickref-hledger.md new file mode 100644 index 0000000..1437194 --- /dev/null +++ b/quickref/quickref-hledger.md @@ -0,0 +1,124 @@ +# hledger + +http://hledger.org/journal.html + +## Basic example + + ; a comment + + 2016/1/1 set opening balance + assets:checking $500.00 + equity:opening balances + + 2016/1/5 farmer's market + expenses:groceries $50.00 + assets:checking + +## Comments + + ; comment + # comment + * comment and org-mode outline node + +## Basic transactions + + DATE [DESCRIPTION] + ACCOUNT AMOUNT + ACCOUNT [AMOUNT] + +Non-comment lines may end with a comment. +Indented comments are attached to the preceding transaction or posting. + +## Dates + + YYYY-MM-DD + YYYY/MM/DD + YYYY.MM.DD + MM-DD + MM/DD + MM.DD + +## Account names + + TOPACCT[:SUBACCT[:...]] + + Revenues:Salary + liabilities:credit card:CITI 1234 + other assets:house + +Account names begin with a letter. +May contain single spaces. +May contain subaccounts separated by : (colon). + +## Amounts + +One of +`COMMODITY QUANTITY`, +`QUANTITY COMMODITY`, +`QUANTITY`. + + 10 + $10.00 + 1,000.0001 USD + 10 "prepaid classes" + 1.000.000,01 + 12,34,567.89 + +Decimal point is . or , (period or comma). +Digit group separator is , or . (the one not used for decimal point). +Any digit grouping can be used, not just thousands. + +## More transaction features + + DATE [FLAG] [(CODE)] DESCRIPTION + [FLAG] ACCOUNT AMOUNT [PRICE] [=BAL] + ... + [FLAG] ACCOUNT AMOUNT [PRICE] [=BAL] + +## Prices + +One of +`@ FIXEDUNITPRICE` +`@@ FIXEDTOTALPRICE` +and/or +`{=FIXEDLOTUNITPRICE}`. + +These do not record market prices. +The lot price syntax is ignored. + +## Balance assertions + +`= AMOUNT` after posting amount & price. + +Asserts the balance in this commodity, +in this account, excluding subaccounts, +on this day. Same day events are processed in parse order. + +## Balance assignments + +## Directives + + KEYWORD ARGS... + + account (alias for apply) + alias + apply + comment + D + end + include + +## account, open + +## close + +## commodity + +## market price + + P DATE [TIME] COMMODITY UNITPRICE + + P 2015/8/9 GBP $1.55 + +Used by -V. +A time is ignored. diff --git a/quickref/quickref-ledger.html b/quickref/quickref-ledger.html new file mode 100644 index 0000000..2ea2fe6 --- /dev/null +++ b/quickref/quickref-ledger.html @@ -0,0 +1,174 @@ + + + + + + + Plain Text Accounting, a guide to Ledger and friends + + + + + + + + + + + + + + + + + + + + + +
+ +

Ledger

+

http://ledger-cli.org/3.0/doc/ledger3.html#Journal-Format
+http://ricostacruz.com/cheatsheets/ledger.html

+

Basic example

+
; a comment
+
+2016/1/1 set opening balance
+   assets:checking       $500.00
+   equity:opening balances
+
+2016/1/5 farmer's market
+   expenses:groceries     $50.00
+   Assets:checking
+

Comments, directives, and/or transactions in any order.

+

Comments

+
; comment
+# comment
+% comment
+| comment
+* comment and org-mode outline node
+

Non-comment lines may end with a comment. Indented comments are attached to the preceding transaction or posting.

+

Basic transactions

+
DATE [DESCRIPTION]
+   ACCOUNT    AMOUNT
+   ACCOUNT    [AMOUNT]
+

A transaction contains any number of indented postings (usually two), whose amounts must sum to zero. At least two spaces required between account and amount. One amount may be omitted.

+

Dates

+
YYYY-MM-DD
+YYYY/MM/DD
+YYYY.MM.DD
+MM-DD
+MM/DD
+MM.DD
+

Other formats allowed if specified with --input-date-format.

+

Account names

+
TOPACCT[:SUBACCT[:...]]
+
+Revenues:Salary
+liabilities:credit card:CITI 1234
+other assets:house
+

Account names begin with a letter. May contain single spaces. May contain subaccounts separated by : (colon).

+

Amounts

+

One of COMMODITY QUANTITY, QUANTITY COMMODITY, QUANTITY.

+
10
+$10.00
+1,000.0001 USD
+10 "prepaid classes"
+

COMMODITY is a symbol, word or phrase; if it contains spaces or numbers, it must be in double quotes. It can be on the left or right, with or without a separating space. QUANTITY is a number with 0 or more decimal places. Decimal point is . (period). Digits can be grouped into thousands by , (comma). Amount styles influence the standard display style for each commodity.

+

More transaction features

+
DATE [FLAG] [(CODE)] DESCRIPTION
+   [FLAG] ACCOUNT  AMOUNT [PRICE] [=BAL]
+   ...
+   [FLAG] ACCOUNT  [AMOUNT [PRICE] [=BAL]]
+

FLAG (aka STATE) is empty, ! or * meaning uncleared, pending or cleared CODE is any string, in parentheses DESCRIPTION can be a payee name, narration, or both

+

Prices

+

One of @ UNITPRICE, @@ TOTALPRICE and/or one of {LOTUNITPRICE}, {=FIXEDLOTUNITPRICE} and/or [LOTDATE].

+

A UNITPRICE or TOTALPRICE also records a market price on this date. A LOTDATE is written in square brackets.

+

Balance assertions

+

= AMOUNT after posting amount & price.

+
2016-03-10
+   Expenses:Food      $20
+   Assets:Cash       $-20 = $80
+

Asserts the balance in this commodity, in this account, excluding subaccounts, at this point in the parse order.

+

Balance assignments

+

= AMOUNT with no preceding/inferred posting amount.

+
2012-03-10 Adjustment
+   Assets:Cash            = $50
+   Expenses:Misc 
+

Sets the posting amount so as to make the balance assertion true. (The other amountless posting allows the transaction to balance).

+

Directives

+
KEYWORD ARGS...
+   [SUBDIRECTIVES]
+
+account 
+
+alias
+apply
+assert
+bucket
+capture
+check
+comment
+commodity
+define
+end
+expr
+fixed
+include
+P 
+
+payee
+tag
+test
+year
+
+Timeclock directives:
+i
+o
+b
+h
+

account, open

+
account ACCOUNT 
+   [SUBDIRECTIVES]
+
+account Revenues:Salary
+account Expenses:Food:Chicken
+   note chicken food expenses
+   alias food
+   payee ^(KFC|Popeyes)$
+   check commodity == "$"
+   assert commodity == "$"
+   eval print("Hello!")
+   default
+

Gives more error checking with --strict or --pedantic. Optional subdirectives do more stuff.

+

close

+

commodity

+
commodity COMMODITY
+
+commodity EUR
+commodity $
+  note American Dollars
+  format $1,000.00
+  nomarket
+  default
+

Gives more error checking with --strict or --pedantic. Optional subdirectives do more stuff.

+

market price

+
P DATE TIME COMMODITY UNITPRICE
+
+P 2004/06/21 02:18:02 AAPL $32.91
+P 2004/06/21 02:18:02 AU $400.00
+

Used by -V and -X. Also set by transaction prices.

+ +
+ + + + diff --git a/quickref/quickref-ledger.md b/quickref/quickref-ledger.md new file mode 100644 index 0000000..c4c67c9 --- /dev/null +++ b/quickref/quickref-ledger.md @@ -0,0 +1,205 @@ +# Ledger + +http://ledger-cli.org/3.0/doc/ledger3.html#Journal-Format +http://ricostacruz.com/cheatsheets/ledger.html + +## Basic example + + ; a comment + + 2016/1/1 set opening balance + assets:checking $500.00 + equity:opening balances + + 2016/1/5 farmer's market + expenses:groceries $50.00 + Assets:checking + +Comments, directives, and/or transactions in any order. + +## Comments + + ; comment + # comment + % comment + | comment + * comment and org-mode outline node + +Non-comment lines may end with a comment. +Indented comments are attached to the preceding transaction or posting. + +## Basic transactions + + DATE [DESCRIPTION] + ACCOUNT AMOUNT + ACCOUNT [AMOUNT] + +A transaction contains any number of indented postings (usually two), whose amounts must sum to zero. +At least two spaces required between account and amount. +One amount may be omitted. + +## Dates + + YYYY-MM-DD + YYYY/MM/DD + YYYY.MM.DD + MM-DD + MM/DD + MM.DD + +Other formats allowed if specified with `--input-date-format`. + +## Account names + + TOPACCT[:SUBACCT[:...]] + + Revenues:Salary + liabilities:credit card:CITI 1234 + other assets:house + +Account names begin with a letter. +May contain single spaces. +May contain subaccounts separated by : (colon). + +## Amounts + +One of +`COMMODITY QUANTITY`, +`QUANTITY COMMODITY`, +`QUANTITY`. + + 10 + $10.00 + 1,000.0001 USD + 10 "prepaid classes" + +COMMODITY is a symbol, word or phrase; if it contains spaces or numbers, it must be in double quotes. +It can be on the left or right, with or without a separating space. +QUANTITY is a number with 0 or more decimal places. +Decimal point is . (period). +Digits can be grouped into thousands by , (comma). +Amount styles influence the standard display style for each commodity. + +## More transaction features + + DATE [FLAG] [(CODE)] DESCRIPTION + [FLAG] ACCOUNT AMOUNT [PRICE] [=BAL] + ... + [FLAG] ACCOUNT [AMOUNT [PRICE] [=BAL]] + +FLAG (aka STATE) is empty, ! or * meaning uncleared, pending or cleared +CODE is any string, in parentheses +DESCRIPTION can be a payee name, narration, or both + +## Prices + +One of +`@ UNITPRICE`, +`@@ TOTALPRICE` +and/or one of +`{LOTUNITPRICE}`, +`{=FIXEDLOTUNITPRICE}` +and/or +`[LOTDATE]`. + +A UNITPRICE or TOTALPRICE also records a market price on this date. +A LOTDATE is written in square brackets. + +## Balance assertions + +`= AMOUNT` after posting amount & price. + + 2016-03-10 + Expenses:Food $20 + Assets:Cash $-20 = $80 + +Asserts the balance in this commodity, +in this account, excluding subaccounts, +at this point in the parse order. + +## Balance assignments + +`= AMOUNT` with no preceding/inferred posting amount. + + 2012-03-10 Adjustment + Assets:Cash = $50 + Expenses:Misc + +Sets the posting amount so as to make the balance assertion true. (The other amountless posting allows the transaction to balance). + +## Directives + + KEYWORD ARGS... + [SUBDIRECTIVES] + + account + + alias + apply + assert + bucket + capture + check + comment + commodity + define + end + expr + fixed + include + P + + payee + tag + test + year + + Timeclock directives: + i + o + b + h + +## account, open + + account ACCOUNT + [SUBDIRECTIVES] + + account Revenues:Salary + account Expenses:Food:Chicken + note chicken food expenses + alias food + payee ^(KFC|Popeyes)$ + check commodity == "$" + assert commodity == "$" + eval print("Hello!") + default + +Gives more error checking with --strict or --pedantic. +Optional subdirectives do more stuff. + +## close + +## commodity + + commodity COMMODITY + + commodity EUR + commodity $ + note American Dollars + format $1,000.00 + nomarket + default + +Gives more error checking with --strict or --pedantic. +Optional subdirectives do more stuff. + +## market price + + P DATE TIME COMMODITY UNITPRICE + + P 2004/06/21 02:18:02 AAPL $32.91 + P 2004/06/21 02:18:02 AU $400.00 + +Used by -V and -X. +Also set by transaction prices.