@@ 221-251 (lines=31) @@ | ||
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.""" |
|
223 | if settings.CHECK_REF: |
|
224 | references = item.find_references() |
|
225 | text_refs = [] |
|
226 | for ref_item in references: |
|
227 | path, line = ref_item |
|
228 | path = path.replace("\\", "/") # always use unix-style paths |
|
229 | ||
230 | if line: |
|
231 | text_refs.append( |
|
232 | "\\begin{{quote}} \\verb|{p}| (line {line})\\end{{quote}}".format( |
|
233 | p=path, line=line |
|
234 | ) |
|
235 | ) |
|
236 | else: |
|
237 | text_refs.append( |
|
238 | "\\begin{{quote}} \\verb|{p}|\\end{{quote}}".format(p=path) |
|
239 | ) |
|
240 | ||
241 | return "\n".join(ref for ref in text_refs) |
|
242 | else: |
|
243 | references = item.references |
|
244 | text_refs = [] |
|
245 | for ref_item in references: |
|
246 | path = ref_item["path"] |
|
247 | path = path.replace("\\", "/") # always use unix-style paths |
|
248 | text_refs.append( |
|
249 | "\\begin{{quote}} \\verb|{r}|\\end{{quote}}".format(r=path) |
|
250 | ) |
|
251 | return "\n".join(ref for ref in text_refs) |
|
252 | ||
253 | def format_links(self, items, linkify): |
|
254 | """Format a list of linked items in LaTeX.""" |
@@ 39-61 (lines=23) @@ | ||
36 | else: |
|
37 | return "> '{r}'".format(r=item.ref) |
|
38 | ||
39 | def format_references(self, item): |
|
40 | """Format an external reference in Markdown.""" |
|
41 | if settings.CHECK_REF: |
|
42 | references = item.find_references() |
|
43 | text_refs = [] |
|
44 | for ref_item in references: |
|
45 | path, line = ref_item |
|
46 | path = path.replace("\\", "/") # always use unix-style paths |
|
47 | ||
48 | if line: |
|
49 | text_refs.append("> `{p}` (line {line})".format(p=path, line=line)) |
|
50 | else: |
|
51 | text_refs.append("> `{p}`".format(p=path)) |
|
52 | ||
53 | return "\n".join(ref for ref in text_refs) |
|
54 | else: |
|
55 | references = item.references |
|
56 | text_refs = [] |
|
57 | for ref_item in references: |
|
58 | path = ref_item["path"] |
|
59 | path = path.replace("\\", "/") # always use unix-style paths |
|
60 | text_refs.append("> '{r}'".format(r=path)) |
|
61 | return "\n".join(ref for ref in text_refs) |
|
62 | ||
63 | def format_links(self, items, linkify): |
|
64 | """Format a list of linked items in Markdown.""" |
@@ 137-157 (lines=21) @@ | ||
134 | else: |
|
135 | return "Reference: '{r}'".format(r=item.ref) |
|
136 | ||
137 | def format_references(self, item): |
|
138 | """Format an external reference in text.""" |
|
139 | if settings.CHECK_REF: |
|
140 | ref = item.find_references() |
|
141 | text_refs = [] |
|
142 | for ref_item in ref: |
|
143 | path, line = ref_item |
|
144 | path = path.replace("\\", "/") # always use unix-style paths |
|
145 | if line: |
|
146 | text_refs.append("{p} (line {line})".format(p=path, line=line)) |
|
147 | else: |
|
148 | text_refs.append("{p}".format(p=path)) |
|
149 | return "Reference: {}".format(", ".join(ref for ref in text_refs)) |
|
150 | else: |
|
151 | references = item.references |
|
152 | text_refs = [] |
|
153 | for ref_item in references: |
|
154 | path = ref_item["path"] |
|
155 | path = path.replace("\\", "/") # always use unix-style paths |
|
156 | text_refs.append("'{p}'".format(p=path)) |
|
157 | return "Reference: {}".format(", ".join(text_ref for text_ref in text_refs)) |
|
158 | ||
159 | def _chunks(self, text): |
|
160 | """Yield wrapped lines of text.""" |