Skip to content

Commit 8cad579

Browse files
misc maintainability additions
1 parent 0322220 commit 8cad579

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

Sources/HTMLKitMacros/InterpolationLookup.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ private extension InterpolationLookup {
164164
}
165165
}
166166

167+
// MARK: Misc
167168
// copy & paste `HTMLKitTests.swift` into https://swift-ast-explorer.com/ to get this working
168169
extension TypeSyntax {
169170
var identifierType : IdentifierTypeSyntax? { self.as(IdentifierTypeSyntax.self) }

Sources/HTMLKitUtilities/HTMLKitUtilities.swift

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ public extension HTMLElementAttribute.Extra {
210210
}
211211
}
212212

213+
// MARK: contenteditable
213214
enum contenteditable : String {
214215
case `true`, `false`
215216
case plaintextOnly
@@ -222,10 +223,12 @@ public extension HTMLElementAttribute.Extra {
222223
}
223224
}
224225

226+
// MARK: controlslist
225227
enum controlslist : String {
226228
case nodownload, nofullscreen, noremoteplayback
227229
}
228230

231+
// MARK: crossorigin
229232
enum crossorigin : String {
230233
case anonymous
231234
case useCredentials
@@ -238,22 +241,27 @@ public extension HTMLElementAttribute.Extra {
238241
}
239242
}
240243

244+
// MARK: decoding
241245
enum decoding : String {
242246
case sync, async, auto
243247
}
244248

249+
// MARK: dir
245250
enum dir : String {
246251
case auto, ltr, rtl
247252
}
248253

254+
// MARK: dirname
249255
enum dirname : String {
250256
case ltr, rtl
251257
}
252258

259+
// MARK: draggable
253260
enum draggable : String {
254261
case `true`, `false`
255262
}
256263

264+
// MARK: download
257265
enum download {
258266
case empty
259267
case filename(String)
@@ -279,10 +287,12 @@ public extension HTMLElementAttribute.Extra {
279287
}
280288
}
281289

290+
// MARK: enterkeyhint
282291
enum enterkeyhint : String {
283292
case enter, done, go, next, previous, search, send
284293
}
285294

295+
// MARK: event
286296
enum event : String {
287297
case accept, afterprint, animationend, animationiteration, animationstart
288298
case beforeprint, beforeunload, blur
@@ -305,6 +315,7 @@ public extension HTMLElementAttribute.Extra {
305315
case waiting, wheel
306316
}
307317

318+
// MARK: fetchpriority
308319
enum fetchpriority : String {
309320
case high, low, auto
310321
}
@@ -385,6 +396,11 @@ public extension HTMLElementAttribute.Extra {
385396
}
386397
}
387398

399+
// MARK: kind
400+
enum kind : String {
401+
case subtitles, captions, chapters, metadata
402+
}
403+
388404
// MARK: loading
389405
enum loading : String {
390406
case eager, lazy
@@ -547,6 +563,7 @@ public extension HTMLElementAttribute.Extra {
547563
case treeitem
548564
}
549565

566+
// MARK: sandbox
550567
enum sandbox : String {
551568
case allowDownloads
552569
case allowForms
@@ -583,49 +600,57 @@ public extension HTMLElementAttribute.Extra {
583600
}
584601
}
585602

603+
// MARK: scripttype
586604
enum scripttype : String {
587605
case importmap, module, speculationrules
588606
}
589607

608+
// MARK: scope
590609
enum scope : String {
591610
case row, col, rowgroup, colgroup
592611
}
593612

613+
// MARK: shadowrootmode
594614
enum shadowrootmode : String {
595615
case open, closed
596616
}
617+
618+
// MARK: shadowrootclonable
597619
enum shadowrootclonable : String {
598620
case `true`, `false`
599621
}
600622

623+
// MARK: shape
601624
enum shape : String {
602625
case rect, circle, poly, `default`
603626
}
604627

628+
// MARK: spellcheck
605629
enum spellcheck : String {
606630
case `true`, `false`
607631
}
608632

633+
// MARK: target
609634
enum target : String {
610635
case _self, _blank, _parent, _top, _unfencedTop
611636
}
612637

613-
enum kind : String {
614-
case subtitles, captions, chapters, metadata
615-
}
616-
638+
// MARK: translate
617639
enum translate : String {
618640
case yes, no
619641
}
620642

643+
// MARK: virtualkeyboardpolicy
621644
enum virtualkeyboardpolicy : String {
622645
case auto, manual
623646
}
624647

648+
// MARK: wrap
625649
enum wrap : String {
626650
case hard, soft
627651
}
628652

653+
// MARK: writingsuggestions
629654
enum writingsuggestions : String {
630655
case `true`, `false`
631656
}

Tests/HTMLKitTests/ElementTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,18 +355,21 @@ extension ElementTests {
355355
}
356356

357357
// MARK: th
358+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th
358359
@Test func th() {
359360
let string:StaticString = #th(rowspan: 2, scope: .colgroup)
360361
#expect(string == "<th rowspan=\"2\" scope=\"colgroup\"></th>")
361362
}
362363

363364
// MARK: track
365+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track
364366
@Test func track() {
365367
let string:StaticString = #track(default: true, kind: .captions, label: "tesT")
366368
#expect(string == "<track default kind=\"captions\" label=\"tesT\">")
367369
}
368370

369371
// MARK: video
372+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video
370373
@Test func video() {
371374
var string:StaticString = #video(controlslist: [.nodownload, .nofullscreen, .noremoteplayback])
372375
#expect(string == "<video controlslist=\"nodownload nofullscreen noremoteplayback\"></video>")

0 commit comments

Comments
 (0)