mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-15 19:22:19 +08:00
feat(core): add 'unescape' filter to file name templating (#622)
This commit is contained in:
parent
f05d8c3c0e
commit
4a34f52d4f
|
@ -93,7 +93,11 @@ namespace BililiveRecorder.Core.Templating
|
||||||
templateOptions.MemberAccessStrategy.MemberNameStrategy = MemberNameStrategies.CamelCase;
|
templateOptions.MemberAccessStrategy.MemberNameStrategy = MemberNameStrategies.CamelCase;
|
||||||
templateOptions.ValueConverters.Add(o => o is JContainer j ? new JContainerValue(j) : null);
|
templateOptions.ValueConverters.Add(o => o is JContainer j ? new JContainerValue(j) : null);
|
||||||
templateOptions.Filters.AddFilter("format_qn",
|
templateOptions.Filters.AddFilter("format_qn",
|
||||||
static (FluidValue input, FilterArguments arguments, TemplateContext context) => new StringValue(StreamQualityNumber.MapToString((int)input.ToNumberValue())));
|
static (FluidValue input, FilterArguments arguments, TemplateContext context)
|
||||||
|
=> new StringValue(StreamQualityNumber.MapToString((int)input.ToNumberValue())));
|
||||||
|
templateOptions.Filters.AddFilter("unescape",
|
||||||
|
static (FluidValue input, FilterArguments arguments, TemplateContext context)
|
||||||
|
=> new StringValue(System.Net.WebUtility.HtmlDecode(input.ToStringValue())));
|
||||||
|
|
||||||
var context = new TemplateContext(data, templateOptions);
|
var context = new TemplateContext(data, templateOptions);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user