BadScript 2
Loading...
Searching...
No Matches
BadExecuteScriptNodeTransformer.cs
Go to the documentation of this file.
2
3namespace BadHtml.Transformer;
4
9{
11 protected override bool CanTransform(BadHtmlContext context)
12 {
13 return context.InputNode.Name == "script" && context.InputNode.Attributes["lang"]?.Value == "bs2";
14 }
15
17 protected override void TransformNode(BadHtmlContext context)
18 {
19 string code = context.InputNode.InnerText;
20
21 BadObject result = context.ParseAndExecute(code, context.CreateInnerPosition());
22 }
23}
Implements the Html Context for the Transformation Process.
BadObject ParseAndExecute(string code, BadSourcePosition pos)
Parses and executes the specified code.
BadSourcePosition CreateInnerPosition()
Creates the Source Position of the current Input Nodes Inner Content.
readonly HtmlNode InputNode
The Current Input Node.
Base class of all Node transformers.
Executes the current script block if the lang attribute is bs2.
The Base Class for all BadScript Objects.
Definition BadObject.cs:14
Implementations of Html Node Transformers that are used in the Transformation Process.
Contains the Runtime Objects.
Definition BadArray.cs:10