From 5fbfdd6821bc3b7aa02976a888052272fd16fbe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= <76261501+zecakeh@users.noreply.github.com> Date: Thu, 20 Jun 2024 10:42:40 +0200 Subject: [PATCH] Fix generated HTML (#1880) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add tr as child of thead in HTML tables It is invalid HTML for th to be the direct children of thead Signed-off-by: Kévin Commaille * Remove unnecessary HTML code end tag Signed-off-by: Kévin Commaille * Avoid nesting p HTML elements A p HTML element cannot contain other block elements, so the "parent" element is closed when the first "child" one is opened. We need to use Page.RenderString with options to force Hugo to keep the wrapping p elements even if the content contains a single paragraph. Signed-off-by: Kévin Commaille * Add missing HTML details end tags Signed-off-by: Kévin Commaille * Replace HTML a self-closing tag with start and end tags The a element start and end tags are mandatory. Signed-off-by: Kévin Commaille * Replace obsolete HTML name attribute with id Signed-off-by: Kévin Commaille * Add changelog Signed-off-by: Kévin Commaille --- .../internal/newsfragments/1880.clarification | 1 + content/client-server-api/modules/push.md | 14 +++++++------- layouts/partials/events/render-event.html | 2 ++ .../partials/openapi/render-content-type.html | 6 ++++-- .../partials/openapi/render-object-table.html | 16 ++++++++++------ layouts/partials/openapi/render-operation.html | 2 +- layouts/partials/openapi/render-responses.html | 6 ++++-- layouts/shortcodes/definition.html | 2 ++ 8 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 changelogs/internal/newsfragments/1880.clarification diff --git a/changelogs/internal/newsfragments/1880.clarification b/changelogs/internal/newsfragments/1880.clarification new file mode 100644 index 00000000..56090e20 --- /dev/null +++ b/changelogs/internal/newsfragments/1880.clarification @@ -0,0 +1 @@ +Fix validation errors in generated HTML. diff --git a/content/client-server-api/modules/push.md b/content/client-server-api/modules/push.md index c674bac9..2d828a01 100644 --- a/content/client-server-api/modules/push.md +++ b/content/client-server-api/modules/push.md @@ -521,7 +521,7 @@ Definition: } ``` - **`.m.rule.is_user_mention`** + **`.m.rule.is_user_mention`** {{< added-in v="1.7" >}} @@ -555,7 +555,7 @@ Definition: } ``` - **`.m.rule.contains_display_name`** + **`.m.rule.contains_display_name`** {{% changed-in v="1.7" %}} @@ -590,7 +590,7 @@ Definition: } ``` - **`.m.rule.is_room_mention`** + **`.m.rule.is_room_mention`** {{< added-in v="1.7" >}} @@ -624,7 +624,7 @@ Definition: } ``` - **`.m.rule.roomnotif`** + **`.m.rule.roomnotif`** {{% changed-in v="1.7" %}} @@ -662,7 +662,7 @@ Definition: } ``` -**`.m.rule.tombstone`** +**`.m.rule.tombstone`** Matches any state event whose type is `m.room.tombstone`. This is intended to notify users of a room when it is upgraded, similar to what @@ -696,7 +696,7 @@ Definition: } ``` -**`.m.rule.reaction`** +**`.m.rule.reaction`** {{% added-in v="1.7" %}} @@ -776,7 +776,7 @@ Definition: ##### Default Content Rules - **`.m.rule.contains_user_name`** + **`.m.rule.contains_user_name`** {{% changed-in v="1.7" %}} diff --git a/layouts/partials/events/render-event.html b/layouts/partials/events/render-event.html index 71ba60bd..154e51bf 100644 --- a/layouts/partials/events/render-event.html +++ b/layouts/partials/events/render-event.html @@ -101,4 +101,6 @@ {{ end }} {{ end }} + + diff --git a/layouts/partials/openapi/render-content-type.html b/layouts/partials/openapi/render-content-type.html index 036522de..96033e16 100644 --- a/layouts/partials/openapi/render-content-type.html +++ b/layouts/partials/openapi/render-content-type.html @@ -16,8 +16,10 @@ - - + + + + {{ range $idx, $content_type := $content_types }} diff --git a/layouts/partials/openapi/render-object-table.html b/layouts/partials/openapi/render-object-table.html index d2b09acb..3fd49f0b 100644 --- a/layouts/partials/openapi/render-object-table.html +++ b/layouts/partials/openapi/render-object-table.html @@ -31,9 +31,11 @@ {{ end }} - - - + + + + + {{ range $property_name, $property := $properties }} @@ -68,7 +70,7 @@ {{ if reflect.IsMap .additionalProperties }} - + @@ -90,8 +92,10 @@ resolve-additional-types.) {{ end }} - - + + + + {{ $property := . }} diff --git a/layouts/partials/openapi/render-operation.html b/layouts/partials/openapi/render-operation.html index 8c6fce0e..ef525353 100644 --- a/layouts/partials/openapi/render-operation.html +++ b/layouts/partials/openapi/render-operation.html @@ -46,7 +46,7 @@ {{ partial "changed-in" (dict "changes_dict" (index $operation_data "x-changedInMatrixVersion")) }} {{ end -}} -

{{ $operation_data.description | markdownify }}

+{{ $operation_data.description | page.RenderString (dict "display" "block") }}
Content-TypeDescription
Content-TypeDescription
{{ . }}
NameTypeDescription
NameTypeDescription
<Other properties><Other properties> {{ partial "partials/property-type" .additionalProperties | safeHTML }} {{ partial "partials/property-description" (dict "property" .additionalProperties) }}
{{ . }}
TypeDescription
TypeDescription
diff --git a/layouts/partials/openapi/render-responses.html b/layouts/partials/openapi/render-responses.html index 0ffc4884..80dcb582 100644 --- a/layouts/partials/openapi/render-responses.html +++ b/layouts/partials/openapi/render-responses.html @@ -20,8 +20,10 @@
- - + + + + {{ range $code, $response := $responses }} diff --git a/layouts/shortcodes/definition.html b/layouts/shortcodes/definition.html index a1f0904e..f5d50e75 100644 --- a/layouts/shortcodes/definition.html +++ b/layouts/shortcodes/definition.html @@ -66,4 +66,6 @@ {{ jsonify (dict "indent" " ") $example }} ``` + +
StatusDescription
StatusDescription