Skip to content

Commit ccce68b

Browse files
committed
Make object, map, label, input, button, select, textarea inline elements
They are according to the HTML 4 spec. <script> is also technically inline, but we omit it here because it is usually used in in places where this doesn't matter, and readability would suffer a lot if consecutive script elements were always joined on the same line.
1 parent 5a97297 commit ccce68b

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ include = [
4646
"tests/**/*.py",
4747
"examples/**.py",
4848
]
49+
extend-exclude = ["src/minihtml/tags.py"]
4950

5051
[tool.ruff.lint]
5152
extend-select = [

src/minihtml/tags.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@
299299
#: The ``embed`` element.
300300
embed: PrototypeEmpty = make_prototype("embed", empty=True, omit_end_tag=True)
301301
#: The ``object`` element.
302-
object: PrototypeNonEmpty = make_prototype("object")
302+
object: PrototypeNonEmpty = make_prototype("object", inline=True)
303303
#: The ``object`` element. Alias for :data:`object`.
304304
object_ = object
305305
#: The ``video`` element.
@@ -309,7 +309,7 @@
309309
#: The ``track`` element.
310310
track: PrototypeEmpty = make_prototype("track", empty=True, omit_end_tag=True)
311311
#: The ``map`` element.
312-
map: PrototypeNonEmpty = make_prototype("map")
312+
map: PrototypeNonEmpty = make_prototype("map", inline=True)
313313
#: The ``map`` element. Alias for :data:`map`.
314314
map_ = map
315315
#: The ``area`` element.
@@ -337,23 +337,23 @@
337337
#: The ``form`` element.
338338
form: PrototypeNonEmpty = make_prototype("form")
339339
#: The ``label`` element.
340-
label: PrototypeNonEmpty = make_prototype("label")
340+
label: PrototypeNonEmpty = make_prototype("label", inline=True)
341341
#: The ``input`` element.
342-
input: PrototypeEmpty = make_prototype("input", empty=True, omit_end_tag=True)
342+
input: PrototypeEmpty = make_prototype("input", inline=True, empty=True, omit_end_tag=True)
343343
#: The ``input`` element. Alias for :data:`input`.
344344
input_ = input
345345
#: The ``button`` element.
346-
button: PrototypeNonEmpty = make_prototype("button")
346+
button: PrototypeNonEmpty = make_prototype("button", inline=True)
347347
#: The ``select`` element.
348-
select: PrototypeNonEmpty = make_prototype("select")
348+
select: PrototypeNonEmpty = make_prototype("select", inline=True)
349349
#: The ``datalist`` element.
350350
datalist: PrototypeNonEmpty = make_prototype("datalist")
351351
#: The ``optgroup`` element.
352352
optgroup: PrototypeNonEmpty = make_prototype("optgroup")
353353
#: The ``option`` element.
354354
option: PrototypeNonEmpty = make_prototype("option")
355355
#: The ``textarea`` element.
356-
textarea: PrototypeNonEmpty = make_prototype("textarea")
356+
textarea: PrototypeNonEmpty = make_prototype("textarea", inline=True)
357357
#: The ``output`` element.
358358
output: PrototypeNonEmpty = make_prototype("output")
359359
#: The ``progress`` element.
@@ -382,4 +382,4 @@
382382
slot: PrototypeNonEmpty = make_prototype("slot")
383383
#: The ``canvas`` element.
384384
canvas: PrototypeNonEmpty = make_prototype("canvas")
385-
# [[[end]]] (checksum: 9d0f6f3a6fdd91db8b23518117d3e1e2)
385+
# [[[end]]] (checksum: 122bdfe2f4c7ca99f14dbdad1426dedb)

tags/html5.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,15 @@ tags:
156156
omit_end_tag: true
157157
object:
158158
alias: object_
159+
inline: true
159160
video:
160161
audio:
161162
track:
162163
empty: true
163164
omit_end_tag: true
164165
map:
165166
alias: map_
167+
inline: true
166168
area:
167169
empty: true
168170
omit_end_tag: true
@@ -188,16 +190,21 @@ tags:
188190
#
189191
form:
190192
label:
193+
inline: true
191194
input:
192195
alias: input_
196+
inline: true
193197
empty: true
194198
omit_end_tag: true
195199
button:
200+
inline: true
196201
select:
202+
inline: true
197203
datalist:
198204
optgroup:
199205
option:
200206
textarea:
207+
inline: true
201208
output:
202209
progress:
203210
meter:

0 commit comments

Comments
 (0)