Runs the Template with the specified arguments.
78 {
79 options ??= new BadHtmlTemplateOptions();
81
82
83 HtmlDocument input = new HtmlDocument();
84 input.OptionUseIdAttribute = true;
85 input.LoadHtml(src);
86
87
88 HtmlDocument output = new HtmlDocument();
89 output.OptionUseIdAttribute = true;
90 output.LoadHtml("");
93
94 if (model != null)
95 {
98 "Model",
99 mod,
100 executionContext.
Scope,
102 );
103 }
104
105 foreach (HtmlNode node in input.DocumentNode.ChildNodes)
106 {
107 BadHtmlContext ctx =
108 new BadHtmlContext(node, output.DocumentNode, executionContext,
FilePath, src, options,
m_FileSystem);
109 BadHtmlNodeTransformer.Transform(ctx);
110 }
111
112 return output;
113 }
string GetSource()
Returns the source code of the template. Loads the source code if it is not loaded yet.
Exposes the BadScript Runtime Functionality to Consumers.
The Execution Context. Every execution of a script needs a context the script is running in....
BadScope Scope
The Root Scope of the Context.
void SetCaller(BadScope? caller)
Sets the Caller of the Scope.
void DefineVariable(string name, BadObject value, BadScope? caller=null, BadPropertyInfo? info=null, BadObject[]? attributes=null)
Defines a new Variable in the current scope.
The Base Class for all BadScript Objects.
Stores Meta Information about a Property.
The Any Prototype, Base type for all types.
static readonly BadAnyPrototype Instance
The Instance of the BadAnyPrototype.
string GetFullPath(string path)
Returns the full path of the given path.