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",
".film":
return "video"
case "js", "javascript":
return "script"
case:
return "iframe"
}
@@ -375,6 +377,8 @@ parse_type_hint :: proc(type_hint: string) -> string {
return "video"
case "f", "iframe", "frame":
return "iframe"
case "s", "script", "js", "javascript":
return "script"
case:
return ""
}
+5
View File
@@ -311,6 +311,11 @@ print_html :: proc(token: ^Token) {
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:
fmt.print("<br>\n")
+2
View File
@@ -83,6 +83,8 @@ print_token :: proc(token: ^Token, depth: int = 0) {
type_str = "Video"
case TokenType.Iframe:
type_str = "Iframe"
case TokenType.Script:
type_str = "Script"
}
value_str := ""
+3
View File
@@ -38,6 +38,7 @@ TokenType :: enum {
Audio,
Video,
Iframe,
Script,
}
TokenValue :: union {
@@ -610,6 +611,8 @@ parse_embeds :: proc(token: ^Token) {
embed_token_type = .Audio
} else if e_type == "video" {
embed_token_type = .Video
} else if e_type == "script" {
embed_token_type = .Script
} else {
embed_token_type = .Iframe
}