MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _doc_link

Method _doc_link

tensorflow/tools/docs/parser.py:418–439  ·  view source on GitHub ↗

Generate a link for a @{$...} reference.

(self, string, link_text, manual_link_text,
                relative_path_to_root)

Source from the content-addressed store, hash-verified

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):

Callers 1

_one_refMethod · 0.95

Calls 5

_link_text_to_htmlMethod · 0.95
_doc_missingMethod · 0.95
findMethod · 0.45
joinMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected