Link to HTML anchors, where they exist

This commit is contained in:
Richard van der Hoff 2023-04-06 02:07:03 +01:00
parent 3736461cd1
commit 3c52648c50

View file

@ -95,6 +95,9 @@
* `items`: if the type is an array, array of dictionaries describing the * `items`: if the type is an array, array of dictionaries describing the
format of the array's items format of the array's items
* `anchor`: optional HTML element id for the target type, which will be used to link to it.
*/}} */}}
{{ define "partials/property-type" }} {{ define "partials/property-type" }}
{{ $type := .type }} {{ $type := .type }}
@ -135,6 +138,8 @@
* `patternProperties`: optional dictionary for properties with names * `patternProperties`: optional dictionary for properties with names
adhering to a regex pattern adhering to a regex pattern
* `anchor`: optional HTML element id for the target type, which will be used to link to it.
The title has a higher priority than anything else. The title has a higher priority than anything else.
*/}} */}}
{{ define "partials/type-or-title" }} {{ define "partials/type-or-title" }}
@ -145,6 +150,9 @@
This means we can write things like `EventFilter` rather than `object`. This means we can write things like `EventFilter` rather than `object`.
*/}} */}}
{{ $type = .title }} {{ $type = .title }}
{{ if .anchor }}
{{ $type = printf "<a href=\"#%s\">%s</a>" (htmlEscape .anchor) (htmlEscape $type) | safeHTML }}
{{ end }}
{{ else if reflect.IsMap .additionalProperties }} {{ else if reflect.IsMap .additionalProperties }}
{{/* {{/*
If the property uses `additionalProperties` to describe its If the property uses `additionalProperties` to describe its