@@ -64,7 +64,11 @@ def format_property_row(self, schema_ref, prop_name, prop_info, prop_path=[], in
64
64
65
65
This may include embedded objects with their own properties.
66
66
"""
67
+ if not in_schema_ref :
68
+ in_schema_ref = schema_ref
67
69
70
+ schema_anchor = self .traverser .get_schema_name (in_schema_ref )
71
+
68
72
formatted = [] # The row itself
69
73
70
74
within_action = prop_path == ['Actions' ]
@@ -211,7 +215,14 @@ def format_property_row(self, schema_ref, prop_name, prop_info, prop_path=[], in
211
215
if formatted_details ['has_direct_prop_details' ] and not formatted_details ['has_action_details' ]:
212
216
# If there are prop_details (enum details), add a note to the description:
213
217
if has_enum :
214
- text_descr = _ ('For the possible property values, see %(link)s in Property details.' ) % {'link' : prop_name }
218
+ if self .markdown_mode == 'slate' or not schema_anchor :
219
+ text_descr = (_ ('For the possible property values, see %(link)s in Property details.' ) %
220
+ {'link' : prop_name })
221
+ else :
222
+ anchor = schema_anchor .lower () + '-' + prop_name .lower ()
223
+ text_descr = (_ ('For the possible property values, see %(link)s in Property details.' ) %
224
+ {'link' : '[' + prop_name + '](#' + anchor + ')' })
225
+
215
226
else :
216
227
text_descr = _ ('For more information about this property, see Property details.' )
217
228
formatted_details ['descr' ] += ' ' + self .formatter .italic (text_descr )
@@ -648,9 +659,19 @@ def format_as_prop_details(self, prop_name, prop_description, rows):
648
659
return "\n " .join (contents )
649
660
650
661
651
- def link_to_own_schema (self , schema_ref , schema_full_uri ):
652
- """Format a reference to a schema."""
653
- result = super ().link_to_own_schema (schema_ref , schema_full_uri )
662
+ def link_to_own_schema (self , schema_ref , schema_uri ):
663
+ schema_name = self .traverser .get_schema_name (schema_ref )
664
+ if not schema_name :
665
+ schema_name = schema_ref
666
+
667
+ if self .markdown_mode == 'slate' :
668
+ return self .formatter .italic (schema_name )
669
+
670
+ if self .is_documented_schema (schema_ref ):
671
+ result = '[' + schema_name + '](#' + schema_name .lower () + ')'
672
+ else :
673
+ result = '[' + schema_name + '](' + schema_uri + ')'
674
+
654
675
return self .formatter .italic (result )
655
676
656
677
@@ -665,7 +686,13 @@ def emit(self):
665
686
contents = []
666
687
667
688
for section in self .sections :
689
+ schema_name = section .get ('schema_name' )
690
+
668
691
contents .append (section .get ('heading' ))
692
+ # if there are version numbers in the headings, add an anchor tag for the section using only the section name
693
+ if schema_name and not self .markdown_mode == 'slate' and not self .config .get ('omit_version_in_headers' ):
694
+ contents .append ('<a name="' + schema_name .lower () + '"></a>' )
695
+
669
696
if section .get ('release_history' ):
670
697
contents .append (section ['release_history' ])
671
698
if section .get ('conditional_requirements' ):
@@ -726,6 +753,11 @@ def emit(self):
726
753
detail_names .sort (key = str .lower )
727
754
for detail_name in detail_names :
728
755
contents .append (self .format_head_four (detail_name , 0 ))
756
+
757
+ # add section/schema-specific anchor tag
758
+ if schema_name and not self .markdown_mode == 'slate' :
759
+ contents .append ('<a name="' + schema_name .lower () + '-' + detail_name .lower () + '"></a>' )
760
+
729
761
det_info = section ['property_details' ][detail_name ]
730
762
731
763
if len (det_info ) == 1 :
0 commit comments