reader ¤
Module to read a file/stream and pre-process the documentation lines.
Algorithm is as follows:
- preprocess_stream: yield documentation lines.
- preprocess_lines: group documentation lines as blocks of documentation.
- process_blocks: tidy blocks by tag in a dictionary.
Classes:
-
DocBlock
–A documentation block.
-
DocFile
–A shell script or documentation file.
-
DocLine
–A documentation line.
-
DocStream
–A stream of shell code or documentation.
-
DocType
–Enumeration of the possible types of documentation.
DocBlock ¤
A documentation block.
Parameters:
Methods:
-
append
–Append a line to the block.
Attributes:
-
doc_type
(str
) –The block type.
-
first_line
(DocLine
) –The block's first doc line.
-
lineno
(int
) –The block's first line number.
-
lines_number
(int
) –The number of lines in the block.
-
path
(str
) –The block's origin file path.
-
tag
(str
) –The block's tag.
-
value
(str
) –The block's first line.
-
values
(list[str]
) –The block's lines.
Source code in src/shellman/reader.py
89 90 91 92 93 94 95 96 97 |
|
append ¤
append(line: DocLine) -> None
Append a line to the block.
Parameters:
-
line
(DocLine
) –The doc line to append.
Source code in src/shellman/reader.py
105 106 107 108 109 110 111 |
|
DocFile ¤
DocFile(path: str)
A shell script or documentation file.
Parameters:
-
path
(str
) –The path to the file.
Source code in src/shellman/reader.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
DocLine ¤
A documentation line.
Parameters:
-
path
(str
) –The origin file path.
-
lineno
(int
) –The line number in the file.
-
tag
(str | None
) –The line's tag, if any.
-
value
(str
) –The line's value.
Attributes:
Source code in src/shellman/reader.py
48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
DocStream ¤
A stream of shell code or documentation.
Parameters:
Source code in src/shellman/reader.py
159 160 161 162 163 164 165 166 167 168 |
|
DocType ¤
Enumeration of the possible types of documentation.
Attributes: