BadScript 2
Loading...
Searching...
No Matches
BadCopyScriptNodeTransformer.cs
Go to the documentation of this file.
1using HtmlAgilityPack;
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 //Deep Clone
20 HtmlNode? node = context.InputNode.CloneNode(true);
21
22 //Append Node to output
23 context.OutputNode.AppendChild(node);
24 }
25}
Implements the Html Context for the Transformation Process.
readonly HtmlNode InputNode
The Current Input Node.
readonly HtmlNode OutputNode
The Current Output Node.
Base class of all Node transformers.
Copies the current script node to the output if the lang attribute is not bs2.
Implementations of Html Node Transformers that are used in the Transformation Process.