This way, Sphinx ABI extension can parse symbols only once, while keep displaying results in separate files.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -160,6 +160,7 @@ class AbiParser: · 159 unmodified lines | ||
| 160 | 160 | self.data[fdata.key] = { |
| 161 | 161 | "what": [content], |
| 162 | 162 | "file": [fdata.file_ref], |
| 163 | + "path": fdata.ftype, | |
| 163 | 164 | "line_no": fdata.ln, |
| 164 | 165 | } |
| 165 | 166 | |
| @@ -182,8 +183,6 @@ class AbiParser: · 16 unmodified lines | ||
| 182 | 183 | if new_what: |
| 183 | 184 | fdata.label = "" |
| 184 | 185 | |
| 185 | − self.data[fdata.key]["type"] = fdata.ftype | |
| 186 | − | |
| 187 | 186 | if "description" in self.data[fdata.key]: |
| 188 | 187 | self.data[fdata.key]["description"] += "\n\n" |
| 189 | 188 | |
| @@ -299,6 +298,7 @@ class AbiParser: · 109 unmodified lines | ||
| 299 | 298 | fdata.nametag = {} |
| 300 | 299 | fdata.nametag["what"] = [f"File {path}/{basename}"] |
| 301 | 300 | fdata.nametag["type"] = "File" |
| 301 | + fdata.nametag["path"] = fdata.ftype | |
| 302 | 302 | fdata.nametag["file"] = [fdata.file_ref] |
| 303 | 303 | fdata.nametag["line_no"] = 1 |
| 304 | 304 | fdata.nametag["description"] = "" |
| @@ -427,7 +427,8 @@ class AbiParser: · 122 unmodified lines | ||
| 427 | 427 | |
| 428 | 428 | return new_desc + "\n\n" |
| 429 | 429 | |
| 430 | − def doc(self, output_in_txt=False, show_file=True): | |
| 430 | + def doc(self, output_in_txt=False, show_symbols=True, show_file=True, | |
| 431 | + filter_path=None): | |
| 431 | 432 | """Print ABI at stdout""" |
| 432 | 433 | |
| 433 | 434 | part = None |
| @@ -435,12 +436,20 @@ class AbiParser: · 1 unmodified line | ||
| 435 | 436 | key=lambda x: (x[1].get("type", ""), |
| 436 | 437 | x[1].get("what"))): |
| 437 | 438 | |
| 438 | − wtype = v.get("type", "Var") | |
| 439 | + wtype = v.get("type", "Symbol") | |
| 439 | 440 | file_ref = v.get("file") |
| 440 | 441 | names = v.get("what", [""]) |
| 441 | 442 | |
| 442 | − if not show_file and wtype == "File": | |
| 443 | − continue | |
| 443 | + if wtype == "File": | |
| 444 | + if not show_file: | |
| 445 | + continue | |
| 446 | + else: | |
| 447 | + if not show_symbols: | |
| 448 | + continue | |
| 449 | + | |
| 450 | + if filter_path: | |
| 451 | + if v.get("path") != filter_path: | |
| 452 | + continue | |
| 444 | 453 | |
| 445 | 454 | msg = "" |
| 446 | 455 | |