De-duplicate header id's by using explicit <h> tags.

Change: 147416710
This commit is contained in:
A. Unique TensorFlower 2017-02-13 17:33:17 -08:00 committed by TensorFlower Gardener
parent c3c31f6475
commit 8a97f8a4b6
2 changed files with 7 additions and 5 deletions
tensorflow/tools/docs

View File

@ -308,7 +308,7 @@ class UpdateTags(py_guide_parser.PyGuideParser):
"""Rewrites a Python guide so that each section has an explicit tag."""
def process_section(self, line_number, section_title, tag):
self.replace_line(line_number, '## %s<a id="%s"/>' % (section_title, tag))
self.replace_line(line_number, '<h2 id="%s">%s</h2>' % (tag, section_title))
def other_docs(src_dir, output_dir, visitor, doc_index):

View File

@ -619,7 +619,7 @@ def _generate_markdown_for_class(full_name, duplicate_names, py_class,
if properties:
docs += '## Properties\n\n'
for property_name, prop in sorted(properties, key=lambda x: x[0]):
docs += '### `%s`<a id="%s"/>\n\n%s\n\n' % (
docs += '<h3 id="%s"><code>%s</code></h3>\n\n%s\n\n' % (
property_name, property_name,
_md_docstring(prop, relative_path, duplicate_of, doc_index, index))
docs += '\n\n'
@ -629,8 +629,8 @@ def _generate_markdown_for_class(full_name, duplicate_names, py_class,
for method_name, method in sorted(methods, key=lambda x: x[0]):
method_signature = method_name + _generate_signature(method,
reverse_index)
docs += '### `%s`<a id="%s"/>\n\n%s\n\n' % (
method_signature, method_name, _md_docstring(
docs += '<h3 id="%s"><code>%s</code></h3>\n\n%s\n\n' % (
method_name, method_signature, _md_docstring(
method, relative_path, duplicate_of, doc_index, index))
docs += '\n\n'
@ -638,7 +638,9 @@ def _generate_markdown_for_class(full_name, duplicate_names, py_class,
docs += '## Class Members\n\n'
# TODO(wicke): Document the value of the members, at least for basic types.
docs += '\n\n'.join(
['%s<a id="%s"/>' % (field, field) for field in sorted(field_names)])
['<h3 id="%s"><code>%s</code></h3>' % (field, field)
for field in sorted(field_names)])
docs += '\n\n'
return docs