doc: don't use sed; fix accidental dedenting of some lists (#961)
The sed code was showing an error message, not too precise. Pandoc's lua filters to the rescue! [ci skip]
This commit is contained in:
		
							parent
							
								
									3474cb08bd
								
							
						
					
					
						commit
						5435150d39
					
				
							
								
								
									
										9
									
								
								Shake.hs
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								Shake.hs
									
									
									
									
									
								
							| @ -20,7 +20,6 @@ compiling is recommended; run the script in interpreted mode to do that. | |||||||
| It requires stack (https://haskell-lang.org/get-started) and | It requires stack (https://haskell-lang.org/get-started) and | ||||||
| auto-installs the packages above. Also, some rules require: | auto-installs the packages above. Also, some rules require: | ||||||
| 
 | 
 | ||||||
| - GNU sed |  | ||||||
| - groff | - groff | ||||||
| - m4 | - m4 | ||||||
| - makeinfo | - makeinfo | ||||||
| @ -86,10 +85,6 @@ towebmd = "-t markdown-smart-fenced_divs --atx-headers" | |||||||
| 
 | 
 | ||||||
| main = do | main = do | ||||||
| 
 | 
 | ||||||
|   -- try to ensure we have a modern sed |  | ||||||
|   sed' <- readCreateProcess (shell "which gsed || which sed") "" |  | ||||||
|   let sed = sed' ++ " -E" |  | ||||||
| 
 |  | ||||||
|   -- hledger manual also includes the markdown files from here: |   -- hledger manual also includes the markdown files from here: | ||||||
|   let commandsdir = "hledger/Hledger/Cli/Commands" |   let commandsdir = "hledger/Hledger/Cli/Commands" | ||||||
|   commandmds <- filter (".md" `isSuffixOf`) . map (commandsdir </>) <$> S.getDirectoryContents commandsdir |   commandmds <- filter (".md" `isSuffixOf`) . map (commandsdir </>) <$> S.getDirectoryContents commandsdir | ||||||
| @ -378,9 +373,7 @@ main = do | |||||||
|       need [src] |       need [src] | ||||||
|       cmd Shell |       cmd Shell | ||||||
|         -- "m4 -P -DHELP -I" commandsdir lib src "|" |         -- "m4 -P -DHELP -I" commandsdir lib src "|" | ||||||
|         pandoc fromsrcmd src "-t plain" |         pandoc fromsrcmd src "--lua-filter" "tools/pandoc-dedent-code-blocks.lua" "-t plain" ">" out | ||||||
|         "|" sed "-e" ["'s/^    //'"] |  | ||||||
|         ">" out |  | ||||||
| 
 | 
 | ||||||
|     -- MISC |     -- MISC | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -18,21 +18,21 @@ control-d or control-c to exit. | |||||||
| Features: | Features: | ||||||
| 
 | 
 | ||||||
| -   add tries to provide useful defaults, using the most similar (by | -   add tries to provide useful defaults, using the most similar (by | ||||||
| description) recent transaction (filtered by the query, if any) as a |     description) recent transaction (filtered by the query, if any) as a | ||||||
| template. |     template. | ||||||
| -   You can also set the initial defaults with command line arguments. | -   You can also set the initial defaults with command line arguments. | ||||||
| -   Readline-style edit keys can be used during data entry. | -   Readline-style edit keys can be used during data entry. | ||||||
| -   The tab key will auto-complete whenever possible - accounts, | -   The tab key will auto-complete whenever possible - accounts, | ||||||
| descriptions, dates (yesterday, today, tomorrow). If the input area |     descriptions, dates (yesterday, today, tomorrow). If the input area | ||||||
| is empty, it will insert the default value. |     is empty, it will insert the default value. | ||||||
| -   If the journal defines a default commodity, it will be added to any | -   If the journal defines a default commodity, it will be added to any | ||||||
| bare numbers entered. |     bare numbers entered. | ||||||
| -   A parenthesised transaction code may be entered following a date. | -   A parenthesised transaction code may be entered following a date. | ||||||
| -   Comments and tags may be entered following a description or amount. | -   Comments and tags may be entered following a description or amount. | ||||||
| -   If you make a mistake, enter < at any prompt to restart the | -   If you make a mistake, enter < at any prompt to restart the | ||||||
| transaction. |     transaction. | ||||||
| -   Input prompts are displayed in a different colour when the terminal | -   Input prompts are displayed in a different colour when the terminal | ||||||
| supports it. |     supports it. | ||||||
| 
 | 
 | ||||||
| Example (see the tutorial for a detailed explanation): | Example (see the tutorial for a detailed explanation): | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -97,10 +97,10 @@ data fields interpolated like so: | |||||||
| -   MAX truncates at this width (optional) | -   MAX truncates at this width (optional) | ||||||
| -   FIELDNAME must be enclosed in parentheses, and can be one of: | -   FIELDNAME must be enclosed in parentheses, and can be one of: | ||||||
| 
 | 
 | ||||||
| -   depth_spacer - a number of spaces equal to the account's depth, |     -   depth_spacer - a number of spaces equal to the account's depth, | ||||||
|         or if MIN is specified, MIN * depth spaces. |         or if MIN is specified, MIN * depth spaces. | ||||||
| -   account - the account's name |     -   account - the account's name | ||||||
| -   total - the account's balance/posted total, right justified |     -   total - the account's balance/posted total, right justified | ||||||
| 
 | 
 | ||||||
| Also, FMT can begin with an optional prefix to control how | Also, FMT can begin with an optional prefix to control how | ||||||
| multi-commodity amounts are rendered: | multi-commodity amounts are rendered: | ||||||
| @ -117,12 +117,12 @@ Some example formats: | |||||||
| 
 | 
 | ||||||
| -   %(total) - the account's total | -   %(total) - the account's total | ||||||
| -   %-20.20(account) - the account's name, left justified, padded to 20 | -   %-20.20(account) - the account's name, left justified, padded to 20 | ||||||
| characters and clipped at 20 characters |     characters and clipped at 20 characters | ||||||
| -   %,%-50(account)  %25(total) - account name padded to 50 characters, | -   %,%-50(account)  %25(total) - account name padded to 50 characters, | ||||||
| total padded to 20 characters, with multiple commodities rendered on |     total padded to 20 characters, with multiple commodities rendered on | ||||||
| one line |     one line | ||||||
| -   %20(total)  %2(depth_spacer)%-(account) - the default format for the | -   %20(total)  %2(depth_spacer)%-(account) - the default format for the | ||||||
| single-column balance report |     single-column balance report | ||||||
| 
 | 
 | ||||||
| Colour support | Colour support | ||||||
| 
 | 
 | ||||||
| @ -169,8 +169,8 @@ There are three types of multicolumn balance report, showing different | |||||||
| information: | information: | ||||||
| 
 | 
 | ||||||
| 1.  By default: each column shows the sum of postings in that period, ie | 1.  By default: each column shows the sum of postings in that period, ie | ||||||
| the account's change of balance in that period. This is useful eg |     the account's change of balance in that period. This is useful eg | ||||||
| for a monthly income statement: |     for a monthly income statement: | ||||||
| 
 | 
 | ||||||
|     $ hledger balance --quarterly income expenses -E |     $ hledger balance --quarterly income expenses -E | ||||||
|     Balance changes in 2008: |     Balance changes in 2008: | ||||||
| @ -185,8 +185,8 @@ for a monthly income statement: | |||||||
|                        ||     $-1      $1       0       0  |                        ||     $-1      $1       0       0  | ||||||
| 
 | 
 | ||||||
| 2.  With --cumulative: each column shows the ending balance for that | 2.  With --cumulative: each column shows the ending balance for that | ||||||
| period, accumulating the changes across periods, starting from 0 at |     period, accumulating the changes across periods, starting from 0 at | ||||||
| the report start date: |     the report start date: | ||||||
| 
 | 
 | ||||||
|     $ hledger balance --quarterly income expenses -E --cumulative |     $ hledger balance --quarterly income expenses -E --cumulative | ||||||
|     Ending balances (cumulative) in 2008: |     Ending balances (cumulative) in 2008: | ||||||
| @ -201,10 +201,10 @@ the report start date: | |||||||
|                        ||         $-1           0           0           0  |                        ||         $-1           0           0           0  | ||||||
| 
 | 
 | ||||||
| 3.  With --historical/-H: each column shows the actual historical ending | 3.  With --historical/-H: each column shows the actual historical ending | ||||||
| balance for that period, accumulating the changes across periods, |     balance for that period, accumulating the changes across periods, | ||||||
| starting from the actual balance at the report start date. This is |     starting from the actual balance at the report start date. This is | ||||||
| useful eg for a multi-period balance sheet, and when you are showing |     useful eg for a multi-period balance sheet, and when you are showing | ||||||
| only the data after a certain start date: |     only the data after a certain start date: | ||||||
| 
 | 
 | ||||||
|     $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1 |     $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1 | ||||||
|     Ending balances (historical) in 2008/04/01-2008/12/31: |     Ending balances (historical) in 2008/04/01-2008/12/31: | ||||||
|  | |||||||
| @ -83,14 +83,14 @@ $ hledger print -Ocsv | |||||||
| "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","","" | "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","","" | ||||||
| 
 | 
 | ||||||
| -   There is one CSV record per posting, with the parent transaction's | -   There is one CSV record per posting, with the parent transaction's | ||||||
| fields repeated. |     fields repeated. | ||||||
| -   The "txnidx" (transaction index) field shows which postings belong | -   The "txnidx" (transaction index) field shows which postings belong | ||||||
| to the same transaction. (This number might change if transactions |     to the same transaction. (This number might change if transactions | ||||||
| are reordered within the file, files are parsed/included in a |     are reordered within the file, files are parsed/included in a | ||||||
| different order, etc.) |     different order, etc.) | ||||||
| -   The amount is separated into "commodity" (the symbol) and "amount" | -   The amount is separated into "commodity" (the symbol) and "amount" | ||||||
| (numeric quantity) fields. |     (numeric quantity) fields. | ||||||
| -   The numeric amount is repeated in either the "credit" or "debit" | -   The numeric amount is repeated in either the "credit" or "debit" | ||||||
| column, for convenience. (Those names are not accurate in the |     column, for convenience. (Those names are not accurate in the | ||||||
| accounting sense; it just puts negative amounts under credit and |     accounting sense; it just puts negative amounts under credit and | ||||||
| zero or greater amounts under debit.) |     zero or greater amounts under debit.) | ||||||
|  | |||||||
| @ -118,11 +118,11 @@ This command predates print --auto, and currently does much the same | |||||||
| thing, but with these differences: | thing, but with these differences: | ||||||
| 
 | 
 | ||||||
| -   with multiple files, rewrite lets rules in any file affect all other | -   with multiple files, rewrite lets rules in any file affect all other | ||||||
| files. print --auto uses standard directive scoping; rules affect |     files. print --auto uses standard directive scoping; rules affect | ||||||
| only child files. |     only child files. | ||||||
| 
 | 
 | ||||||
| -   rewrite's query limits which transactions can be rewritten; all are | -   rewrite's query limits which transactions can be rewritten; all are | ||||||
| printed. print --auto's query limits which transactions are printed. |     printed. print --auto's query limits which transactions are printed. | ||||||
| 
 | 
 | ||||||
| -   rewrite applies rules specified on command line or in the journal. | -   rewrite applies rules specified on command line or in the journal. | ||||||
| print --auto applies rules specified in the journal. |     print --auto applies rules specified in the journal. | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user