This commit is contained in:
2026-07-14 21:38:29 +02:00
parent 1d790c3d4a
commit 3ea48cd313
4 changed files with 14 additions and 0 deletions
+4
View File
@@ -360,6 +360,8 @@ detect_embed_type :: proc(url: string) -> string {
".cpk", ".cpk",
".film": ".film":
return "video" return "video"
case "js", "javascript":
return "script"
case: case:
return "iframe" return "iframe"
} }
@@ -375,6 +377,8 @@ parse_type_hint :: proc(type_hint: string) -> string {
return "video" return "video"
case "f", "iframe", "frame": case "f", "iframe", "frame":
return "iframe" return "iframe"
case "s", "script", "js", "javascript":
return "script"
case: case:
return "" return ""
} }
+5
View File
@@ -311,6 +311,11 @@ print_html :: proc(token: ^Token) {
fmt.printf("<iframe src=\"%s\"></iframe>", url) fmt.printf("<iframe src=\"%s\"></iframe>", url)
} }
case TokenType.Script:
if url, ok := token.value.(string); ok {
fmt.printf("<script src=\"%s\"></script>", url)
}
case TokenType.BreakLine: case TokenType.BreakLine:
fmt.print("<br>\n") fmt.print("<br>\n")
+2
View File
@@ -83,6 +83,8 @@ print_token :: proc(token: ^Token, depth: int = 0) {
type_str = "Video" type_str = "Video"
case TokenType.Iframe: case TokenType.Iframe:
type_str = "Iframe" type_str = "Iframe"
case TokenType.Script:
type_str = "Script"
} }
value_str := "" value_str := ""
+3
View File
@@ -38,6 +38,7 @@ TokenType :: enum {
Audio, Audio,
Video, Video,
Iframe, Iframe,
Script,
} }
TokenValue :: union { TokenValue :: union {
@@ -610,6 +611,8 @@ parse_embeds :: proc(token: ^Token) {
embed_token_type = .Audio embed_token_type = .Audio
} else if e_type == "video" { } else if e_type == "video" {
embed_token_type = .Video embed_token_type = .Video
} else if e_type == "script" {
embed_token_type = .Script
} else { } else {
embed_token_type = .Iframe embed_token_type = .Iframe
} }