Generate a link for a @{$...} reference.
(self, string, link_text, manual_link_text,
relative_path_to_root)
| 416 | 'BROKEN_LINK') |
| 417 | |
| 418 | def _doc_link(self, string, link_text, manual_link_text, |
| 419 | relative_path_to_root): |
| 420 | """Generate a link for a @{$...} reference.""" |
| 421 | string = string[1:] # remove leading $ |
| 422 | |
| 423 | # If string has a #, split that part into `hash_tag` |
| 424 | hash_pos = string.find('#') |
| 425 | if hash_pos > -1: |
| 426 | hash_tag = string[hash_pos:] |
| 427 | string = string[:hash_pos] |
| 428 | else: |
| 429 | hash_tag = '' |
| 430 | |
| 431 | if string in self._doc_index: |
| 432 | if not manual_link_text: link_text = self._doc_index[string].title |
| 433 | url = os.path.normpath(os.path.join( |
| 434 | relative_path_to_root, '../..', self._doc_index[string].url)) |
| 435 | link_text = self._link_text_to_html(link_text) |
| 436 | return '<a href="{}{}">{}</a>'.format(url, hash_tag, link_text) |
| 437 | |
| 438 | return self._doc_missing(string, hash_tag, link_text, manual_link_text, |
| 439 | relative_path_to_root) |
| 440 | |
| 441 | def _doc_missing(self, string, unused_hash_tag, unused_link_text, |
| 442 | unused_manual_link_text, unused_relative_path_to_root): |
no test coverage detected