Fix generated HTML (#1880)

* 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 <zecakeh@tedomum.fr>

* Remove unnecessary HTML code end tag

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* 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 <zecakeh@tedomum.fr>

* Add missing HTML details end tags

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* 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 <zecakeh@tedomum.fr>

* Replace obsolete HTML name attribute with id

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Add changelog

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
Kévin Commaille 2024-06-20 10:42:40 +02:00 committed by GitHub
parent 560f29cff3
commit 5fbfdd6821
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 31 additions and 18 deletions

View file

@ -0,0 +1 @@
Fix validation errors in generated HTML.

View file

@ -521,7 +521,7 @@ Definition:
}
```
<a id="_m_rule_is_user_mention"/> **`.m.rule.is_user_mention`**
<a id="_m_rule_is_user_mention"></a> **`.m.rule.is_user_mention`**
{{< added-in v="1.7" >}}
@ -555,7 +555,7 @@ Definition:
}
```
<a id="_m_rule_contains_display_name"/> **`.m.rule.contains_display_name`**
<a id="_m_rule_contains_display_name"></a> **`.m.rule.contains_display_name`**
{{% changed-in v="1.7" %}}
@ -590,7 +590,7 @@ Definition:
}
```
<a id="_m_rule_is_room_mention"/> **`.m.rule.is_room_mention`**
<a id="_m_rule_is_room_mention"></a> **`.m.rule.is_room_mention`**
{{< added-in v="1.7" >}}
@ -624,7 +624,7 @@ Definition:
}
```
<a id="_m_rule_roomnotif"/> **`.m.rule.roomnotif`**
<a id="_m_rule_roomnotif"></a> **`.m.rule.roomnotif`**
{{% changed-in v="1.7" %}}
@ -662,7 +662,7 @@ Definition:
}
```
**<a name="mruletombstone"></a>`.m.rule.tombstone`**
**<a id="mruletombstone"></a>`.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:
}
```
**<a name="mrulereaction"></a>`.m.rule.reaction`**
**<a id="mrulereaction"></a>`.m.rule.reaction`**
{{% added-in v="1.7" %}}
@ -776,7 +776,7 @@ Definition:
##### Default Content Rules
<a id="_m_rule_contains_user_name"/> **`.m.rule.contains_user_name`**
<a id="_m_rule_contains_user_name"></a> **`.m.rule.contains_user_name`**
{{% changed-in v="1.7" %}}

View file

@ -101,4 +101,6 @@
{{ end }}
{{ end }}
</details>
</section>

View file

@ -16,8 +16,10 @@
<table class="content-type-table">
<thead>
<th class="col-name">Content-Type</th>
<th class="col-description">Description</th>
<tr>
<th class="col-name">Content-Type</th>
<th class="col-description">Description</th>
</tr>
</thead>
{{ range $idx, $content_type := $content_types }}
<tr>

View file

@ -31,9 +31,11 @@
<caption>{{ . }}</caption>
{{ end }}
<thead>
<th class="col-name">Name</th>
<th class="col-type">Type</th>
<th class="col-description">Description</th>
<tr>
<th class="col-name">Name</th>
<th class="col-type">Type</th>
<th class="col-description">Description</th>
</tr>
</thead>
{{ range $property_name, $property := $properties }}
@ -68,7 +70,7 @@
{{ if reflect.IsMap .additionalProperties }}
<tr>
<td>&lt;Other properties&gt;</code></td>
<td>&lt;Other properties&gt;</td>
<td><code>{{ partial "partials/property-type" .additionalProperties | safeHTML }}</code></td>
<td>{{ partial "partials/property-description" (dict "property" .additionalProperties) }}</td>
</tr>
@ -90,8 +92,10 @@ resolve-additional-types.)
<caption>{{ . }}</caption>
{{ end }}
<thead>
<th class="col-type">Type</th>
<th class="col-description">Description</th>
<tr>
<th class="col-type">Type</th>
<th class="col-description">Description</th>
</tr>
</thead>
{{ $property := . }}

View file

@ -46,7 +46,7 @@
{{ partial "changed-in" (dict "changes_dict" (index $operation_data "x-changedInMatrixVersion")) }}
{{ end -}}
<p>{{ $operation_data.description | markdownify }}</p>
{{ $operation_data.description | page.RenderString (dict "display" "block") }}
<table class="basic-info">

View file

@ -20,8 +20,10 @@
<table class="response-table">
<thead>
<th class="col-status">Status</th>
<th class="col-status-description">Description</th>
<tr>
<th class="col-status">Status</th>
<th class="col-status-description">Description</th>
</tr>
</thead>
{{ range $code, $response := $responses }}

View file

@ -66,4 +66,6 @@
{{ jsonify (dict "indent" " ") $example }}
```
</details>
</section>