You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The form feed character is \f or https://unicodeplus.com/U+000C
I need my list of things to be output with a form feed character after each thing gets templated. I've tried a couple different things, including:
None of these, when I write the compiled text to file, actually have the form feed character.
I've tried tackling this through the writing to file side, thinking it was something there, but if I only template the thing section and write the form feed character like this, it works:
using (StreamWriter sw = new StreamWriter(File.Open(outputFile, FileMode.CreateNew), Encoding.Unicode))
{
foreach (var thing in thingData)
{
var text = RenderThing(ticket); // this is the handlebars.compile(template + data)
sw.WriteLine(text);
sw.WriteLine("\f");
}
}
This is not an ideal solution because one of the values the template uses for the looped things is the index of the thing in the list, but I can't figure out how to get the template to actually include the real form feed character.
If I pass the formfeed character in with the template data, like this:
public string RenderThing(List<ThingObject> thingData)
{
string compileText = "{{> " + _templateName + "}}";
_patternTemplate ??= _handlebars.Compile(compileText);
var data = new
{
tickets = thingData,
formFeed = "\f"
};
var text = _patternTemplate(data);
return text;
}
and I have the {{{formFeed}}} outside the #each loop, then I can get the form feed character to show up at the end. But if I try to move it into the loop, it's not rendered.
The text was updated successfully, but these errors were encountered:
I have a handlebars template that looks like so:
The form feed character is
\f
or https://unicodeplus.com/U+000CI need my list of
thing
s to be output with a form feed character after eachthing
gets templated. I've tried a couple different things, including:template:
None of these, when I write the compiled text to file, actually have the form feed character.
I've tried tackling this through the writing to file side, thinking it was something there, but if I only template the
thing
section and write the form feed character like this, it works:This is not an ideal solution because one of the values the template uses for the looped
things
is the index of thething
in the list, but I can't figure out how to get the template to actually include the real form feed character.If I pass the formfeed character in with the template data, like this:
and I have the
{{{formFeed}}}
outside the #each loop, then I can get the form feed character to show up at the end. But if I try to move it into the loop, it's not rendered.The text was updated successfully, but these errors were encountered: