Document the listing module.
This commit is contained in:
parent
f870430cf1
commit
bb118c0fbe
1 changed files with 40 additions and 0 deletions
40
README.md
40
README.md
|
@ -80,6 +80,9 @@ Functional Modules
|
||||||
Support Modules
|
Support Modules
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
There modules are not specific to this project but had to be
|
||||||
|
implemented anyway to not require any external dependencies.
|
||||||
|
|
||||||
### ANSI
|
### ANSI
|
||||||
|
|
||||||
### Command Line parsing
|
### Command Line parsing
|
||||||
|
@ -88,6 +91,43 @@ Support Modules
|
||||||
|
|
||||||
### Listing
|
### Listing
|
||||||
|
|
||||||
|
This module implements listing a text file with line numbers and
|
||||||
|
optional highlights of given source lines, optionally with comments
|
||||||
|
for those lines.
|
||||||
|
|
||||||
|
(print-source-listing lines highlights context hl-pre hl-post ctx-pre ctx-post ellipsis)
|
||||||
|
|
||||||
|
* ```lines``` - list of string representing lines of the text file
|
||||||
|
* ```highlights``` - list of highlights (see below)
|
||||||
|
* ```context``` - number of context lines to be shown around highlighted lies
|
||||||
|
* ```hl-pre``` - string introducing highlighted lines
|
||||||
|
* ```hl-post``` - string terminating highlighted lines
|
||||||
|
* ```ctx-pre``` - string introducing context lines
|
||||||
|
* ```ctx-post``` - string terminating context lines
|
||||||
|
* ```ellipsis``` - string representing lines omitted from the output
|
||||||
|
|
||||||
|
Prints given text file represented by the ```lines``` list of strings.
|
||||||
|
|
||||||
|
Lines to be highlighted can be specified in the ```highlights```
|
||||||
|
list. The highlight specification is either a number or a list
|
||||||
|
containing the line number and string comment.
|
||||||
|
|
||||||
|
The lines are actually highlighted by prepending them with
|
||||||
|
```hl-pre``` string and the highlight is finished by appending
|
||||||
|
```hl-post``` to them. Usually some constants from the ```ansi```
|
||||||
|
module are used.
|
||||||
|
|
||||||
|
If some lines are highlighted a number of ```context``` lines
|
||||||
|
surrounding them may be printed as well. If this argument is negative,
|
||||||
|
all non-highlighted lines are printed as context lines.
|
||||||
|
|
||||||
|
Context lines are prepended with ```ctx-pre``` string and terminated
|
||||||
|
by ```ctx-post``` string.
|
||||||
|
|
||||||
|
If some lines between highlight and/or context lines are omitted,
|
||||||
|
```ellipsis``` string is printed on single line as a substitute.
|
||||||
|
|
||||||
|
|
||||||
### Progress
|
### Progress
|
||||||
|
|
||||||
Provides syntax forms and procedures for showing progress of a
|
Provides syntax forms and procedures for showing progress of a
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue