@@ 141-171 (lines=31) @@ | ||
138 | return "\\begin{{quote}} \\verb|{r}|\\end{{quote}}".format(r=item.ref) |
|
139 | ||
140 | ||
141 | def _format_latex_references(item): |
|
142 | """Format an external reference in LaTeX.""" |
|
143 | if settings.CHECK_REF: |
|
144 | references = item.find_references() |
|
145 | text_refs = [] |
|
146 | for ref_item in references: |
|
147 | path, line = ref_item |
|
148 | path = path.replace("\\", "/") # always use unix-style paths |
|
149 | ||
150 | if line: |
|
151 | text_refs.append( |
|
152 | "\\begin{{quote}} \\verb|{p}| (line {line})\\end{{quote}}".format( |
|
153 | p=path, line=line |
|
154 | ) |
|
155 | ) |
|
156 | else: |
|
157 | text_refs.append( |
|
158 | "\\begin{{quote}} \\verb|{p}|\\end{{quote}}".format(p=path) |
|
159 | ) |
|
160 | ||
161 | return "\n".join(ref for ref in text_refs) |
|
162 | else: |
|
163 | references = item.references |
|
164 | text_refs = [] |
|
165 | for ref_item in references: |
|
166 | path = ref_item["path"] |
|
167 | path = path.replace("\\", "/") # always use unix-style paths |
|
168 | text_refs.append( |
|
169 | "\\begin{{quote}} \\verb|{r}|\\end{{quote}}".format(r=path) |
|
170 | ) |
|
171 | return "\n".join(ref for ref in text_refs) |
|
172 | ||
173 | ||
174 | def _format_latex_links(items, linkify): |
@@ 670-692 (lines=23) @@ | ||
667 | return "> '{r}'".format(r=item.ref) |
|
668 | ||
669 | ||
670 | def _format_md_references(item): |
|
671 | """Format an external reference in Markdown.""" |
|
672 | if settings.CHECK_REF: |
|
673 | references = item.find_references() |
|
674 | text_refs = [] |
|
675 | for ref_item in references: |
|
676 | path, line = ref_item |
|
677 | path = path.replace("\\", "/") # always use unix-style paths |
|
678 | ||
679 | if line: |
|
680 | text_refs.append("> `{p}` (line {line})".format(p=path, line=line)) |
|
681 | else: |
|
682 | text_refs.append("> `{p}`".format(p=path)) |
|
683 | ||
684 | return "\n".join(ref for ref in text_refs) |
|
685 | else: |
|
686 | references = item.references |
|
687 | text_refs = [] |
|
688 | for ref_item in references: |
|
689 | path = ref_item["path"] |
|
690 | path = path.replace("\\", "/") # always use unix-style paths |
|
691 | text_refs.append("> '{r}'".format(r=path)) |
|
692 | return "\n".join(ref for ref in text_refs) |
|
693 | ||
694 | ||
695 | def _format_md_links(items, linkify): |
|
@@ 634-654 (lines=21) @@ | ||
631 | return "Reference: '{r}'".format(r=item.ref) |
|
632 | ||
633 | ||
634 | def _format_text_references(item): |
|
635 | """Format an external reference in text.""" |
|
636 | if settings.CHECK_REF: |
|
637 | ref = item.find_references() |
|
638 | text_refs = [] |
|
639 | for ref_item in ref: |
|
640 | path, line = ref_item |
|
641 | path = path.replace("\\", "/") # always use unix-style paths |
|
642 | if line: |
|
643 | text_refs.append("{p} (line {line})".format(p=path, line=line)) |
|
644 | else: |
|
645 | text_refs.append("{p}".format(p=path)) |
|
646 | return "Reference: {}".format(", ".join(ref for ref in text_refs)) |
|
647 | else: |
|
648 | references = item.references |
|
649 | text_refs = [] |
|
650 | for ref_item in references: |
|
651 | path = ref_item["path"] |
|
652 | path = path.replace("\\", "/") # always use unix-style paths |
|
653 | text_refs.append("'{p}'".format(p=path)) |
|
654 | return "Reference: {}".format(", ".join(text_ref for text_ref in text_refs)) |
|
655 | ||
656 | ||
657 | def _format_md_ref(item): |