@@ 568-590 (lines=23) @@ | ||
565 | return "> '{r}'".format(r=item.ref) |
|
566 | ||
567 | ||
568 | def _format_md_references(item): |
|
569 | """Format an external reference in Markdown.""" |
|
570 | if settings.CHECK_REF: |
|
571 | references = item.find_references() |
|
572 | text_refs = [] |
|
573 | for ref_item in references: |
|
574 | path, line = ref_item |
|
575 | path = path.replace("\\", "/") # always use unix-style paths |
|
576 | ||
577 | if line: |
|
578 | text_refs.append("> `{p}` (line {line})".format(p=path, line=line)) |
|
579 | else: |
|
580 | text_refs.append("> `{p}`".format(p=path)) |
|
581 | ||
582 | return "\n".join(ref for ref in text_refs) |
|
583 | else: |
|
584 | references = item.references |
|
585 | text_refs = [] |
|
586 | for ref_item in references: |
|
587 | path = ref_item["path"] |
|
588 | path = path.replace("\\", "/") # always use unix-style paths |
|
589 | text_refs.append("> '{r}'".format(r=path)) |
|
590 | return "\n".join(ref for ref in text_refs) |
|
591 | ||
592 | ||
593 | def _format_md_links(items, linkify, to_html=False): |
|
@@ 532-552 (lines=21) @@ | ||
529 | return "Reference: '{r}'".format(r=item.ref) |
|
530 | ||
531 | ||
532 | def _format_text_references(item): |
|
533 | """Format an external reference in text.""" |
|
534 | if settings.CHECK_REF: |
|
535 | ref = item.find_references() |
|
536 | text_refs = [] |
|
537 | for ref_item in ref: |
|
538 | path, line = ref_item |
|
539 | path = path.replace("\\", "/") # always use unix-style paths |
|
540 | if line: |
|
541 | text_refs.append("{p} (line {line})".format(p=path, line=line)) |
|
542 | else: |
|
543 | text_refs.append("{p}".format(p=path)) |
|
544 | return "Reference: {}".format(", ".join(ref for ref in text_refs)) |
|
545 | else: |
|
546 | references = item.references |
|
547 | text_refs = [] |
|
548 | for ref_item in references: |
|
549 | path = ref_item["path"] |
|
550 | path = path.replace("\\", "/") # always use unix-style paths |
|
551 | text_refs.append("'{p}'".format(p=path)) |
|
552 | return "Reference: {}".format(", ".join(text_ref for text_ref in text_refs)) |
|
553 | ||
554 | ||
555 | def _format_md_ref(item): |
@@ 156-186 (lines=31) @@ | ||
153 | return "\\begin{{quote}} \\verb|{r}|\\end{{quote}}".format(r=item.ref) |
|
154 | ||
155 | ||
156 | def _format_latex_references(item): |
|
157 | """Format an external reference in LaTeX.""" |
|
158 | if settings.CHECK_REF: |
|
159 | references = item.find_references() |
|
160 | text_refs = [] |
|
161 | for ref_item in references: |
|
162 | path, line = ref_item |
|
163 | path = path.replace("\\", "/") # always use unix-style paths |
|
164 | ||
165 | if line: |
|
166 | text_refs.append( |
|
167 | "\\begin{{quote}} \\verb|{p}| (line {line})\\end{{quote}}".format( |
|
168 | p=path, line=line |
|
169 | ) |
|
170 | ) |
|
171 | else: |
|
172 | text_refs.append( |
|
173 | "\\begin{{quote}} \\verb|{p}|\\end{{quote}}".format(p=path) |
|
174 | ) |
|
175 | ||
176 | return "\n".join(ref for ref in text_refs) |
|
177 | else: |
|
178 | references = item.references |
|
179 | text_refs = [] |
|
180 | for ref_item in references: |
|
181 | path = ref_item["path"] |
|
182 | path = path.replace("\\", "/") # always use unix-style paths |
|
183 | text_refs.append( |
|
184 | "\\begin{{quote}} \\verb|{r}|\\end{{quote}}".format(r=path) |
|
185 | ) |
|
186 | return "\n".join(ref for ref in text_refs) |
|
187 | ||
188 | ||
189 | def _format_latex_links(items, linkify): |