summaryrefslogtreecommitdiff
path: root/tests/suite/html/syntax.typ
blob: 4bda0c6865eb82fb07b01ce30eb9b1b658236bb7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--- html-non-char html ---
// Error: 1-9 the character `"\u{fdd0}"` cannot be encoded in HTML
\u{fdd0}

--- html-void-element-with-children html ---
// Error: 2-27 HTML void elements must not have children
#html.elem("img", [Hello])

--- html-pre-starting-with-newline html ---
#html.pre("hello")
#html.pre("\nhello")
#html.pre("\n\nhello")

--- html-textarea-starting-with-newline html ---
#html.textarea("\nenter")

--- html-script html ---
// This should be pretty and indented.
#html.script(
  ```js
  const x = 1
  const y = 2
  console.log(x < y, Math.max(1, 2))
  ```.text,
)

// This should have extra newlines, but no indent because of the multiline
// string literal.
#html.script("console.log(`Hello\nWorld`)")

// This should be untouched.
#html.script(
  type: "text/python",
  ```py
  x = 1
  y = 2
  print(x < y, max(x, y))
  ```.text,
)

--- html-style html ---
// This should be pretty and indented.
#html.style(
  ```css
  body {
    text: red;
  }
  ```.text,
)

--- html-raw-text-contains-elem html ---
// Error: 14-32 HTML raw text element cannot have non-text children
#html.script(html.strong[Hello])

--- html-raw-text-contains-frame html ---
// Error: 2-29 HTML raw text element cannot have non-text children
#html.script(html.frame[Ok])

--- html-raw-text-contains-closing-tag html ---
// Error: 2-32 HTML raw text element cannot contain its own closing tag
// Hint: 2-32 the sequence `</SCRiPT` appears in the raw text
#html.script("hello </SCRiPT ")

--- html-escapable-raw-text-contains-closing-tag html ---
// This is okay because we escape it.
#html.textarea("hello </textarea>")