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

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