Code Duplication    Length = 11-15 lines in 3 locations

doorstop/core/publishers/latex.py 1 location

@@ 195-209 (lines=15) @@
192
            else ""
193
        )
194
195
    def format_ref(self, item):
196
        """Format an external reference in LaTeX."""
197
        if settings.CHECK_REF:
198
            path, line = item.find_ref()
199
            path = path.replace("\\", "/")  # always use unix-style paths
200
            if line:
201
                return (
202
                    "\\begin{{quote}} \\verb|{p}| (line {line})\\end{{quote}}".format(
203
                        p=path, line=line
204
                    )
205
                )
206
            else:
207
                return "\\begin{{quote}} \\verb|{p}|\\end{{quote}}".format(p=path)
208
        else:
209
            return "\\begin{{quote}} \\verb|{r}|\\end{{quote}}".format(r=item.ref)
210
211
    def format_references(self, item):
212
        """Format an external reference in LaTeX."""

doorstop/core/publishers/text.py 1 location

@@ 122-132 (lines=11) @@
119
120
            yield ""  # break between items
121
122
    def format_ref(self, item):
123
        """Format an external reference in text."""
124
        if settings.CHECK_REF:
125
            path, line = item.find_ref()
126
            path = path.replace("\\", "/")  # always use unix-style paths
127
            if line:
128
                return "Reference: {p} (line {line})".format(p=path, line=line)
129
            else:
130
                return "Reference: {p}".format(p=path)
131
        else:
132
            return "Reference: '{r}'".format(r=item.ref)
133
134
    def format_references(self, item):
135
        """Format an external reference in text."""

doorstop/core/publishers/markdown.py 1 location

@@ 26-36 (lines=11) @@
23
        """Create a Markdown attribute list for a heading."""
24
        return " {{#{u} }}".format(u=item.uid) if linkify else ""
25
26
    def format_ref(self, item):
27
        """Format an external reference in Markdown."""
28
        if settings.CHECK_REF:
29
            path, line = item.find_ref()
30
            path = path.replace("\\", "/")  # always use unix-style paths
31
            if line:
32
                return "> `{p}` (line {line})".format(p=path, line=line)
33
            else:
34
                return "> `{p}`".format(p=path)
35
        else:
36
            return "> '{r}'".format(r=item.ref)
37
38
    def format_references(self, item):
39
        """Format an external reference in Markdown."""