Resolve a "@{python symbol}" reference to a relative path. The input to this function should already be stripped of the '@' and '{}', and its output is only the link, not the full Markdown. If `ref_full_name` is the name of a class member, method, or property, the link will point t
(self, ref_full_name, relative_path_to_root)
| 340 | return self._duplicate_of.get(full_name, full_name) |
| 341 | |
| 342 | def reference_to_url(self, ref_full_name, relative_path_to_root): |
| 343 | """Resolve a "@{python symbol}" reference to a relative path. |
| 344 | |
| 345 | The input to this function should already be stripped of the '@' |
| 346 | and '{}', and its output is only the link, not the full Markdown. |
| 347 | |
| 348 | If `ref_full_name` is the name of a class member, method, or property, the |
| 349 | link will point to the page of the containing class, and it will include the |
| 350 | method name as an anchor. For example, `tf.module.MyClass.my_method` will be |
| 351 | translated into a link to |
| 352 | `os.join.path(relative_path_to_root, 'tf/module/MyClass.md#my_method')`. |
| 353 | |
| 354 | Args: |
| 355 | ref_full_name: The fully qualified name of the symbol to link to. |
| 356 | relative_path_to_root: The relative path from the location of the current |
| 357 | document to the root of the API documentation. |
| 358 | |
| 359 | Returns: |
| 360 | A relative path that links from the documentation page of `from_full_name` |
| 361 | to the documentation page of `ref_full_name`. |
| 362 | |
| 363 | Raises: |
| 364 | RuntimeError: If `ref_full_name` is not documented. |
| 365 | TFDocsError: If the @{} syntax cannot be decoded. |
| 366 | """ |
| 367 | master_name = self._duplicate_of.get(ref_full_name, ref_full_name) |
| 368 | |
| 369 | # Check whether this link exists |
| 370 | if master_name not in self._all_names: |
| 371 | raise TFDocsError( |
| 372 | 'Cannot make link to "%s": Not in index.' % master_name) |
| 373 | |
| 374 | ref_path = documentation_path(master_name, self._is_fragment[master_name]) |
| 375 | return os.path.join(relative_path_to_root, ref_path) |
| 376 | |
| 377 | def _one_ref(self, match, relative_path_to_root): |
| 378 | """Return a link for a single "@{symbol}" reference.""" |
no test coverage detected