@@ 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.""" |
@@ 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.""" |
@@ 104-126 (lines=23) @@ | ||
101 | else: |
|
102 | return "> '{r}'".format(r=item.ref) |
|
103 | ||
104 | def format_references(self, item): |
|
105 | """Format an external reference in Markdown.""" |
|
106 | if settings.CHECK_REF: |
|
107 | references = item.find_references() |
|
108 | text_refs = [] |
|
109 | for ref_item in references: |
|
110 | path, line = ref_item |
|
111 | path = path.replace("\\", "/") # always use unix-style paths |
|
112 | ||
113 | if line: |
|
114 | text_refs.append("> `{p}` (line {line})".format(p=path, line=line)) |
|
115 | else: |
|
116 | text_refs.append("> `{p}`".format(p=path)) |
|
117 | ||
118 | return "\n".join(ref for ref in text_refs) |
|
119 | else: |
|
120 | references = item.references |
|
121 | text_refs = [] |
|
122 | for ref_item in references: |
|
123 | path = ref_item["path"] |
|
124 | path = path.replace("\\", "/") # always use unix-style paths |
|
125 | text_refs.append("> '{r}'".format(r=path)) |
|
126 | return "\n".join(ref for ref in text_refs) |
|
127 | ||
128 | def format_links(self, items, linkify): |
|
129 | """Format a list of linked items in Markdown.""" |