File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
tools/tensorflow_docs/api_generator/pretty_docs Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -486,15 +486,14 @@ def top_source_link(location):
486
486
return table
487
487
488
488
489
- def small_source_link (location ):
489
+ def small_source_link (location , text = 'View source' ):
490
490
"""Returns a small source link."""
491
- template = '<a target="_blank" href="{url}">View source</a>\n \n '
492
-
493
- if not location .url :
491
+ if location .url :
492
+ return ('<a target="_blank" class="external" '
493
+ f'href="{ location .url } ">{ text } </a>\n \n ' )
494
+ else :
494
495
return ''
495
496
496
- return template .format (url = location .url )
497
-
498
497
499
498
def build_collapsable_aliases (aliases : List [str ]) -> str :
500
499
"""Returns the top "Aliases" line."""
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ def test_other_source_link_after_table(self):
54
54
55
55
</table>
56
56
57
- <a target="_blank" href="{ url } ">View source</a>
57
+ <a target="_blank" class="external" href="{ url } ">View source</a>
58
58
59
59
""" )
60
60
self .assertEqual (expected , table )
You can’t perform that action at this time.
0 commit comments