Generate a link for a @{tensorflow::...} reference.
(self, string, link_text, unused_manual_link_text,
relative_path_to_root)
| 444 | raise TFDocsError('Unknown Document "%s"' % string) |
| 445 | |
| 446 | def _cc_link(self, string, link_text, unused_manual_link_text, |
| 447 | relative_path_to_root): |
| 448 | """Generate a link for a @{tensorflow::...} reference.""" |
| 449 | # TODO(josh11b): Fix this hard-coding of paths. |
| 450 | if string == 'tensorflow::ClientSession': |
| 451 | ret = 'class/tensorflow/client-session.md' |
| 452 | elif string == 'tensorflow::Scope': |
| 453 | ret = 'class/tensorflow/scope.md' |
| 454 | elif string == 'tensorflow::Status': |
| 455 | ret = 'class/tensorflow/status.md' |
| 456 | elif string == 'tensorflow::Tensor': |
| 457 | ret = 'class/tensorflow/tensor.md' |
| 458 | elif string == 'tensorflow::ops::Const': |
| 459 | ret = 'namespace/tensorflow/ops.md#const' |
| 460 | else: |
| 461 | raise TFDocsError('C++ reference not understood: "%s"' % string) |
| 462 | |
| 463 | # relative_path_to_root gets you to api_docs/python, we go from there |
| 464 | # to api_docs/cc, and then add ret. |
| 465 | cc_relative_path = os.path.normpath(os.path.join( |
| 466 | relative_path_to_root, '../cc', ret)) |
| 467 | |
| 468 | return '<a href="{}"><code>{}</code></a>'.format(cc_relative_path, |
| 469 | link_text) |
| 470 | |
| 471 | |
| 472 | # TODO(aselle): Collect these into a big list for all modules and functions |
no test coverage detected