Code Duplication    Length = 11-15 lines in 3 locations

doorstop/core/publishers/latex.py 1 location

@@ 205-219 (lines=15) @@
202
            else ""
203
        )
204
205
    def format_ref(self, item):
206
        """Format an external reference in LaTeX."""
207
        if settings.CHECK_REF:
208
            path, line = item.find_ref()
209
            path = path.replace("\\", "/")  # always use unix-style paths
210
            if line:
211
                return (
212
                    "\\begin{{quote}} \\verb|{p}| (line {line})\\end{{quote}}".format(
213
                        p=path, line=line
214
                    )
215
                )
216
            else:
217
                return "\\begin{{quote}} \\verb|{p}|\\end{{quote}}".format(p=path)
218
        else:
219
            return "\\begin{{quote}} \\verb|{r}|\\end{{quote}}".format(r=item.ref)
220
221
    def format_references(self, item):
222
        """Format an external reference in LaTeX."""

doorstop/core/publishers/text.py 1 location

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

doorstop/core/publishers/markdown.py 1 location

@@ 91-101 (lines=11) @@
88
        """Create a Markdown attribute list for a heading."""
89
        return " {{#{u}}}".format(u=item.uid) if linkify else ""
90
91
    def format_ref(self, item):
92
        """Format an external reference in Markdown."""
93
        if settings.CHECK_REF:
94
            path, line = item.find_ref()
95
            path = path.replace("\\", "/")  # always use unix-style paths
96
            if line:
97
                return "> `{p}` (line {line})".format(p=path, line=line)
98
            else:
99
                return "> `{p}`".format(p=path)
100
        else:
101
            return "> '{r}'".format(r=item.ref)
102
103
    def format_references(self, item):
104
        """Format an external reference in Markdown."""