Runs the Template with the specified arguments.
77 {
78 options ??= new BadHtmlTemplateOptions();
80
81
82 HtmlDocument input = new HtmlDocument();
83 input.OptionUseIdAttribute = true;
84 input.LoadHtml(src);
85
86
87 HtmlDocument output = new HtmlDocument();
88 output.OptionUseIdAttribute = true;
89 output.LoadHtml("");
90
93 ) ??
94 "/"
95 );
97
98 if (model != null)
99 {
101
103 mod,
104 executionContext.
Scope,
106 );
107 }
108
109 foreach (HtmlNode node in input.DocumentNode.ChildNodes)
110 {
111 BadHtmlContext ctx =
112 new BadHtmlContext(node, output.DocumentNode, executionContext,
FilePath, src, options,
m_FileSystem);
113 BadHtmlNodeTransformer.Transform(ctx);
114 }
115
116 return output;
117 }
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.