Code Duplication    Length = 10-14 lines in 2 locations

doorstop/core/publishers/html.py 1 location

@@ 170-183 (lines=14) @@
167
        for row in self.object.get_traceability():
168
            yield tuple(map(extract_uid, row))
169
170
    def format_item_link(self, item, linkify=True):
171
        """Format an item link in HTML."""
172
        if linkify and is_item(item):
173
            if item.header:
174
                link = '<a href="{p}.html#{u}">{u} {h}</a>'.format(
175
                    u=item.uid, h=item.header, p=item.document.prefix
176
                )
177
            else:
178
                link = '<a href="{p}.html#{u}">{u}</a>'.format(
179
                    u=item.uid, p=item.document.prefix
180
                )
181
            return link
182
        else:
183
            return str(item.uid)  # if not `Item`, assume this is an `UnknownItem`
184
185
    def lines(self, obj, **kwargs):
186
        """Yield lines for an HTML report.

doorstop/core/publishers/markdown.py 1 location

@@ 70-79 (lines=10) @@
67
            links.append(link)
68
        return ", ".join(links)
69
70
    def format_item_link(self, item, linkify=True):
71
        """Format an item link in Markdown."""
72
        if linkify and is_item(item):
73
            if item.header:
74
                return "[{u} {h}]({p}.md#{u})".format(
75
                    u=item.uid, h=item.header, p=item.document.prefix
76
                )
77
            return "[{u}]({p}.md#{u})".format(u=item.uid, p=item.document.prefix)
78
        else:
79
            return str(item.uid)  # if not `Item`, assume this is an `UnknownItem`
80
81
    def format_label_links(self, label, links, linkify):
82
        """Join a string of label and links with formatting."""