public ScriptContext() { Pages = new SharpPages(this); PageFormats.Add(new HtmlPageFormat()); ScriptMethods.Add(new DefaultScripts()); ScriptMethods.Add(new HtmlScripts()); Plugins.Add(new DefaultScriptBlocks()); Plugins.Add(new HtmlScriptBlocks()); FilterTransformers[ScriptConstants.HtmlEncode] = HtmlPageFormat.HtmlEncodeTransformer; FilterTransformers["end"] = stream => (TypeConstants.EmptyByteArray.InMemoryStream() as Stream).InTask(); FilterTransformers["buffer"] = stream => stream.InTask(); Args[nameof(ScriptConfig.MaxQuota)] = ScriptConfig.MaxQuota; Args[nameof(ScriptConfig.DefaultCulture)] = ScriptConfig.CreateCulture(); Args[nameof(ScriptConfig.DefaultDateFormat)] = ScriptConfig.DefaultDateFormat; Args[nameof(ScriptConfig.DefaultDateTimeFormat)] = ScriptConfig.DefaultDateTimeFormat; Args[nameof(ScriptConfig.DefaultTimeFormat)] = ScriptConfig.DefaultTimeFormat; Args[nameof(ScriptConfig.DefaultFileCacheExpiry)] = ScriptConfig.DefaultFileCacheExpiry; Args[nameof(ScriptConfig.DefaultUrlCacheExpiry)] = ScriptConfig.DefaultUrlCacheExpiry; Args[nameof(ScriptConfig.DefaultIndent)] = ScriptConfig.DefaultIndent; Args[nameof(ScriptConfig.DefaultNewLine)] = ScriptConfig.DefaultNewLine; Args[nameof(ScriptConfig.DefaultJsConfig)] = ScriptConfig.DefaultJsConfig; Args[nameof(ScriptConfig.DefaultStringComparison)] = ScriptConfig.DefaultStringComparison; Args[nameof(ScriptConfig.DefaultTableClassName)] = ScriptConfig.DefaultTableClassName; Args[nameof(ScriptConfig.DefaultErrorClassName)] = ScriptConfig.DefaultErrorClassName; }
public TemplateContext() { Pages = new TemplatePages(this); PageFormats.Add(new HtmlPageFormat()); TemplateFilters.Add(new TemplateDefaultFilters()); TemplateFilters.Add(new TemplateHtmlFilters()); Plugins.Add(new TemplateDefaultBlocks()); Plugins.Add(new TemplateHtmlBlocks()); FilterTransformers[TemplateConstants.HtmlEncode] = HtmlPageFormat.HtmlEncodeTransformer; FilterTransformers["end"] = stream => (new MemoryStream(TypeConstants.EmptyByteArray) as Stream).InTask(); Args[nameof(TemplateConfig.MaxQuota)] = TemplateConfig.MaxQuota; Args[nameof(TemplateConfig.DefaultCulture)] = TemplateConfig.CreateCulture(); Args[nameof(TemplateConfig.DefaultDateFormat)] = TemplateConfig.DefaultDateFormat; Args[nameof(TemplateConfig.DefaultDateTimeFormat)] = TemplateConfig.DefaultDateTimeFormat; Args[nameof(TemplateConfig.DefaultTimeFormat)] = TemplateConfig.DefaultTimeFormat; Args[nameof(TemplateConfig.DefaultFileCacheExpiry)] = TemplateConfig.DefaultFileCacheExpiry; Args[nameof(TemplateConfig.DefaultUrlCacheExpiry)] = TemplateConfig.DefaultUrlCacheExpiry; Args[nameof(TemplateConfig.DefaultIndent)] = TemplateConfig.DefaultIndent; Args[nameof(TemplateConfig.DefaultNewLine)] = TemplateConfig.DefaultNewLine; Args[nameof(TemplateConfig.DefaultJsConfig)] = TemplateConfig.DefaultJsConfig; Args[nameof(TemplateConfig.DefaultStringComparison)] = TemplateConfig.DefaultStringComparison; Args[nameof(TemplateConfig.DefaultTableClassName)] = TemplateConfig.DefaultTableClassName; Args[nameof(TemplateConfig.DefaultErrorClassName)] = TemplateConfig.DefaultErrorClassName; }
public TemplateContext() { Pages = new TemplatePages(this); PageFormats.Add(new HtmlPageFormat()); TemplateFilters.Add(new TemplateDefaultFilters()); TemplateFilters.Add(new TemplateHtmlFilters()); FilterTransformers[TemplateConstants.HtmlEncode] = HtmlPageFormat.HtmlEncodeTransformer; FilterTransformers["end"] = stream => (new MemoryStream(TypeConstants.EmptyByteArray) as Stream).InTask(); var culture = CultureInfo.CurrentCulture; if (Equals(culture, CultureInfo.InvariantCulture)) { culture = (CultureInfo)culture.Clone(); culture.NumberFormat.CurrencySymbol = "$"; } Args[TemplateConstants.MaxQuota] = 10000; Args[TemplateConstants.DefaultCulture] = culture; Args[TemplateConstants.DefaultDateFormat] = "yyyy-MM-dd"; Args[TemplateConstants.DefaultDateTimeFormat] = "u"; Args[TemplateConstants.DefaultTimeFormat] = "h\\:mm\\:ss"; Args[TemplateConstants.DefaultFileCacheExpiry] = TimeSpan.FromMinutes(1); Args[TemplateConstants.DefaultUrlCacheExpiry] = TimeSpan.FromMinutes(1); Args[TemplateConstants.DefaultIndent] = "\t"; Args[TemplateConstants.DefaultNewLine] = Environment.NewLine; Args[TemplateConstants.DefaultJsConfig] = "excludetypeinfo"; Args[TemplateConstants.DefaultStringComparison] = StringComparison.Ordinal; Args[TemplateConstants.DefaultTableClassName] = "table"; Args[TemplateConstants.DefaultErrorClassName] = "alert alert-danger"; }
public TemplatePagesContext() { Pages = new TemplatePages(this); PageFormats.Add(new HtmlPageFormat()); TemplateFilters.Add(new TemplateDefaultFilters()); Args[TemplateConstants.DefaultCulture] = CultureInfo.CurrentCulture; Args[TemplateConstants.DefaultDateFormat] = "yyyy-MM-dd"; Args[TemplateConstants.DefaultDateTimeFormat] = "u"; }
public TemplateContext() { Pages = new TemplatePages(this); PageFormats.Add(new HtmlPageFormat()); TemplateFilters.Add(new TemplateDefaultFilters()); FilterTransformers["htmlencode"] = HtmlPageFormat.HtmlEncodeTransformer; Args[TemplateConstants.DefaultCulture] = CultureInfo.CurrentCulture; Args[TemplateConstants.DefaultDateFormat] = "yyyy-MM-dd"; Args[TemplateConstants.DefaultDateTimeFormat] = "u"; Args[TemplateConstants.DefaultCacheExpiry] = TimeSpan.FromHours(1); Args[TemplateConstants.DefaultIndent] = "\t"; Args[TemplateConstants.DefaultNewLine] = Environment.NewLine; Args[TemplateConstants.DefaultJsConfig] = "excludetypeinfo"; }
public TemplateContext() { Pages = new TemplatePages(this); PageFormats.Add(new HtmlPageFormat()); TemplateFilters.Add(new TemplateDefaultFilters()); FilterTransformers[TemplateConstants.HtmlEncode] = HtmlPageFormat.HtmlEncodeTransformer; Args[TemplateConstants.MaxQuota] = 10000; Args[TemplateConstants.DefaultCulture] = CultureInfo.CurrentCulture; Args[TemplateConstants.DefaultDateFormat] = "yyyy-MM-dd"; Args[TemplateConstants.DefaultDateTimeFormat] = "u"; Args[TemplateConstants.DefaultTimeFormat] = "h\\:mm\\:ss"; Args[TemplateConstants.DefaultCacheExpiry] = TimeSpan.FromHours(1); Args[TemplateConstants.DefaultIndent] = "\t"; Args[TemplateConstants.DefaultNewLine] = Environment.NewLine; Args[TemplateConstants.DefaultJsConfig] = "excludetypeinfo"; Args[TemplateConstants.DefaultStringComparison] = StringComparison.Ordinal; }