Skip to content

Commit

Permalink
Fixed linking to aliases.
Browse files Browse the repository at this point in the history
  • Loading branch information
Garth Minette committed Mar 2, 2021
1 parent 2e8813c commit 02c17d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions openscad_docsgen/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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("")
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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":
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from setuptools import setup

VERSION = "1.1.4"
VERSION = "1.1.5"


with open('README.rst') as f:
Expand Down

0 comments on commit 02c17d0

Please sign in to comment.