|
30 | 30 | import re
|
31 | 31 | import os
|
32 | 32 | from os import walk
|
33 |
| -from typing import Generator, List, Tuple |
| 33 | +from typing import Generator, List |
34 | 34 |
|
35 | 35 |
|
36 | 36 | class suppress_stdout_stderr:
|
@@ -163,7 +163,7 @@ def parseRST(rstFile: str) -> docutils.nodes.document:
|
163 | 163 |
|
164 | 164 | '''
|
165 | 165 | # Create rst Parser object
|
166 |
| - parser = docutils.parsers.rst.Parser() |
| 166 | + parser = Parser() |
167 | 167 |
|
168 | 168 | # Open and read the .rst file and store the string of data into input
|
169 | 169 | f = open(rstFile, "r")
|
@@ -233,9 +233,12 @@ def findBadTitlesInDoctree(document: docutils.nodes.document) -> Generator[
|
233 | 233 | # myText will be used to construct headings and append into titleList
|
234 | 234 | myText: str = ""
|
235 | 235 |
|
| 236 | + # lineno will be used to retrieve line numbers of certain headings |
| 237 | + lineno: int = 0 |
| 238 | + |
236 | 239 | # A docutils.nodes object that stores a listOfMarkers text's grandparent node,
|
237 | 240 | # which should have a tagname of title
|
238 |
| - markerGrandparent: docutils.nodes.Title |
| 241 | + markerGrandparent: docutils.nodes.Title = None |
239 | 242 |
|
240 | 243 | # True if the most recent node encountered had a parent with a listOfMarkers tagname
|
241 | 244 | # and a grandparent with a tagname of title
|
@@ -363,9 +366,9 @@ def main(source_paths: List[str], output_format: str) -> bool:
|
363 | 366 | # Print badTitleDictionary Results
|
364 | 367 | print()
|
365 | 368 | for key in badTitleDictionary:
|
366 |
| - for titles in badTitleDictionary[key]: |
367 |
| - print(key + ":" + str(titles[1]) + ": " + errMessage |
368 |
| - + " \"" + titles[0] + "\"" |
| 369 | + for line in badTitleDictionary[key]: |
| 370 | + print( |
| 371 | + key + ":" + str(line[1]) + ": " + errMessage + " \"" + line[0] + "\"" |
369 | 372 | )
|
370 | 373 |
|
371 | 374 | # Exit status of 1
|
|
0 commit comments