From 02c17d070bb4dbd59d8e196b6c134e003303a631 Mon Sep 17 00:00:00 2001 From: Garth Minette Date: Mon, 1 Mar 2021 23:54:50 -0800 Subject: [PATCH] Fixed linking to aliases. --- openscad_docsgen/blocks.py | 13 ++++++++----- setup.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/openscad_docsgen/blocks.py b/openscad_docsgen/blocks.py index ced7088..6e1577b 100644 --- a/openscad_docsgen/blocks.py +++ b/openscad_docsgen/blocks.py @@ -123,7 +123,7 @@ def parse_links(self, line, controller): line = m.group(3) if name not in controller.items_by_name: raise DocsGenException("Invalid Link {{{{{0}}}}} in file {1}, line {2}".format(name, self.origin.file, self.origin.line)) - item, parent = controller.items_by_name[name] + item = controller.items_by_name[name] oline += item.get_link(label=name, currfile=self.origin.file) else: oline += mkdn_esc(line) @@ -180,7 +180,7 @@ def get_markdown(self, controller): if name not in controller.items_by_name: raise DocsGenException(self.title, "Invalid Link '{}', while declaring block:".format(name)) items.append( controller.items_by_name[name] ) - links = ", ".join( item.get_link(currfile=self.origin.file) for item,parent in items ) + links = ", ".join( item.get_link(currfile=self.origin.file) for item in items ) out = [] out.append("**{}:** {}".format(mkdn_esc(self.title), mkdn_esc(links))) out.append("") @@ -645,7 +645,10 @@ def _topics_block_cb(self, title, subtitle, body, origin, meta): self.curr_item.topics = [x.strip() for x in subtitle.split(",")] def _alias_block_cb(self, title, subtitle, body, origin, meta): - self.curr_item.aliases = [x.strip() for x in subtitle.split(",")] + aliases = [x.strip() for x in subtitle.split(",")] + self.curr_item.aliases.extend(aliases) + for alias in aliases: + self.items_by_name[alias] = self.curr_item def _skip_lines(self, lines, line_num=0): while line_num < len(lines): @@ -802,11 +805,11 @@ def _parse_block(self, lines, line_num=0, src_file=None): if not self.curr_section: raise DocsGenException(title, "Must declare Section before declaring block:") if subtitle in self.items_by_name: - prevorig = self.items_by_name[subtitle][0].origin + prevorig = self.items_by_name[subtitle].origin msg = "Previous declaration of `{}` at {}:{}, Redeclared:".format(subtitle, prevorig.file, prevorig.line) raise DocsGenException(title, msg) item = ItemBlock(title, subtitle, body, origin, parent=self.curr_section) - self.items_by_name[subtitle] = (item, self.curr_parent) + self.items_by_name[subtitle] = item self.curr_item = item self.curr_parent = item elif title == "See Also": diff --git a/setup.py b/setup.py index ec4c57c..c36f5fa 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup -VERSION = "1.1.4" +VERSION = "1.1.5" with open('README.rst') as f: