This way, Sphinx ABI extension can parse symbols only once, while keep displaying results in separate files.
Unified · Split
| @@ -160,6 +160,7 @@ class AbiParser: · 159 unmodified lines | |||
| 160 | self.data[fdata.key] = { | 160 | self.data[fdata.key] = { |
| 161 | "what": [content], | 161 | "what": [content], |
| 162 | "file": [fdata.file_ref], | 162 | "file": [fdata.file_ref], |
| 163 | "path": fdata.ftype, | ||
| 163 | "line_no": fdata.ln, | 164 | "line_no": fdata.ln, |
| 164 | } | 165 | } |
| 165 | 166 | ||
| @@ -182,8 +183,6 @@ class AbiParser: · 16 unmodified lines | |||
| 182 | if new_what: | 183 | if new_what: |
| 183 | fdata.label = "" | 184 | fdata.label = "" |
| 184 | 185 | ||
| 185 | self.data[fdata.key]["type"] = fdata.ftype | ||
| 186 | |||
| 187 | if "description" in self.data[fdata.key]: | 186 | if "description" in self.data[fdata.key]: |
| 188 | self.data[fdata.key]["description"] += "\n\n" | 187 | self.data[fdata.key]["description"] += "\n\n" |
| 189 | 188 | ||
| @@ -299,6 +298,7 @@ class AbiParser: · 109 unmodified lines | |||
| 299 | fdata.nametag = {} | 298 | fdata.nametag = {} |
| 300 | fdata.nametag["what"] = [f"File {path}/{basename}"] | 299 | fdata.nametag["what"] = [f"File {path}/{basename}"] |
| 301 | fdata.nametag["type"] = "File" | 300 | fdata.nametag["type"] = "File" |
| 301 | fdata.nametag["path"] = fdata.ftype | ||
| 302 | fdata.nametag["file"] = [fdata.file_ref] | 302 | fdata.nametag["file"] = [fdata.file_ref] |
| 303 | fdata.nametag["line_no"] = 1 | 303 | fdata.nametag["line_no"] = 1 |
| 304 | fdata.nametag["description"] = "" | 304 | fdata.nametag["description"] = "" |
| @@ -427,7 +427,8 @@ class AbiParser: · 122 unmodified lines | |||
| 427 | 427 | ||
| 428 | return new_desc + "\n\n" | 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 | """Print ABI at stdout""" | 432 | """Print ABI at stdout""" |
| 432 | 433 | ||
| 433 | part = None | 434 | part = None |
| @@ -435,12 +436,20 @@ class AbiParser: · 1 unmodified line | |||
| 435 | key=lambda x: (x[1].get("type", ""), | 436 | key=lambda x: (x[1].get("type", ""), |
| 436 | x[1].get("what"))): | 437 | x[1].get("what"))): |
| 437 | 438 | ||
| 438 | wtype = v.get("type", "Var") | 439 | wtype = v.get("type", "Symbol") |
| 439 | file_ref = v.get("file") | 440 | file_ref = v.get("file") |
| 440 | names = v.get("what", [""]) | 441 | names = v.get("what", [""]) |
| 441 | 442 | ||
| 442 | if not show_file and wtype == "File": | 443 | if wtype == "File": |
| 443 | continue | 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 | msg = "" | 454 | msg = "" |
| 446 | 455 | ||