JS
This commit is contained in:
@@ -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 ""
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -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 := ""
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user