Resolve a "@{python symbol}" reference to a Markdown link. This will pick the canonical location for duplicate symbols. The input to this function should already be stripped of the '@' and '{}'. This function returns a Markdown link. If `code_ref` is true, it is assumed that this
(self, link_text, ref_full_name, relative_path_to_root,
code_ref=True)
| 301 | return string |
| 302 | |
| 303 | def python_link(self, link_text, ref_full_name, relative_path_to_root, |
| 304 | code_ref=True): |
| 305 | """Resolve a "@{python symbol}" reference to a Markdown link. |
| 306 | |
| 307 | This will pick the canonical location for duplicate symbols. The |
| 308 | input to this function should already be stripped of the '@' and |
| 309 | '{}'. This function returns a Markdown link. If `code_ref` is |
| 310 | true, it is assumed that this is a code reference, so the link |
| 311 | text will be rendered as code (using backticks). |
| 312 | `link_text` should refer to a library symbol, starting with 'tf.'. |
| 313 | |
| 314 | Args: |
| 315 | link_text: The text of the Markdown link. |
| 316 | ref_full_name: The fully qualified name of the symbol to link to. |
| 317 | relative_path_to_root: The relative path from the location of the current |
| 318 | document to the root of the API documentation. |
| 319 | code_ref: If true (the default), put `link_text` in `...`. |
| 320 | |
| 321 | Returns: |
| 322 | A markdown link to the documentation page of `ref_full_name`. |
| 323 | """ |
| 324 | url = self.reference_to_url(ref_full_name, relative_path_to_root) |
| 325 | |
| 326 | if code_ref: |
| 327 | link_text = link_text.join(['<code>', '</code>']) |
| 328 | else: |
| 329 | link_text = self._link_text_to_html(link_text) |
| 330 | |
| 331 | return '<a href="{}">{}</a>'.format(url, link_text) |
| 332 | |
| 333 | @staticmethod |
| 334 | def _link_text_to_html(link_text): |
no test coverage detected