line' starts or continues a paragraph. Paragraphs may have "hanging indent", e.g. ``` * Bullet point... ... continued ``` In this case, when the higher indentation level ends, so does the paragraph.
(self, line)
| 297 | self.endBlock(line, transform = False) |
| 298 | |
| 299 | def addLine(self, line): |
| 300 | """'line' starts or continues a paragraph. |
| 301 | |
| 302 | Paragraphs may have "hanging indent", e.g. |
| 303 | |
| 304 | ``` |
| 305 | * Bullet point... |
| 306 | ... continued |
| 307 | ``` |
| 308 | |
| 309 | In this case, when the higher indentation level ends, so does the |
| 310 | paragraph.""" |
| 311 | logDiag('addLine line', self.state.lineNumber, ':', line, end='') |
| 312 | |
| 313 | # See https://stackoverflow.com/questions/13648813/what-is-the-pythonic-way-to-count-the-leading-spaces-in-a-string |
| 314 | indent = len(line) - len(line.lstrip()) |
| 315 | |
| 316 | # A hanging paragraph ends due to a less-indented line. |
| 317 | if self.state.para != [] and indent < self.state.hangIndent: |
| 318 | logDiag('addLine: line reduces indentation, emit paragraph') |
| 319 | self.emitPara() |
| 320 | |
| 321 | # A bullet point (or something that looks like one) always ends the |
| 322 | # current paragraph. |
| 323 | if beginBullet.match(line): |
| 324 | logDiag('addLine: line matches beginBullet, emit paragraph') |
| 325 | self.emitPara() |
| 326 | |
| 327 | self.state.addLine(line, indent) |
| 328 | |
| 329 | def apiMatch(self, oldname, newname): |
| 330 | """Returns whether oldname and newname match, up to an API suffix. |
no test coverage detected