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