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
While experimenting with glz::stencil, I noticed that whitespace and newlines around section tags ({{#...}} / {{/...}}) don’t always behave as I would expect.
In some cases an extra leading newline appears, and in others items are concatenated on the same line.
This might be correct and intentional, but it feels a bit strange. I’d like to confirm what the intended behavior is. Each case has comment on expected result below
That passes. the space is preserved inside of {{completed}} but inside of the {{items}} it is not, however it is preserved when it starts with it
Other examples:
I'll just leave it here for people to be wary of. And I also made a PR to maybe fix it.I looked through code, whilst trying to understand if that's intended
That passes. the space is preserved inside of {{completed}} but inside of the {{items}} it is not, however it is preserved when it starts with it
Other examples:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
While experimenting with
glz::stencil, I noticed that whitespace and newlines around section tags ({{#...}} / {{/...}}) don’t always behave as I would expect.In some cases an extra leading newline appears, and in others items are concatenated on the same line.
This might be correct and intentional, but it feels a bit strange. I’d like to confirm what the intended behavior is. Each case has comment on expected result below
godbolt
If this is expected how could I achive something like in expected result of examples? Or the only way is to manually format each item?
Update:
I looked through code, whilst trying to understand if that's intended
assuming test case like that
std::string_view layout = R"({{#items}}{{text}} {{#completed}}✓ {{/completed}}{{^completed}}○ {{/completed}} {{/items}})"; TodoList list{ "Mixed Tasks", {{"Task 1", false, "high", "home", 1, 0}, {"Task 2", true, "low", "home", 1, 0}}, true, 2}; auto result = glz::stencil(layout, list); expect(result == "Task 1 ○ Task 2 ✓ ");That passes. the space is preserved inside of
{{completed}}but inside of the{{items}}it is not, however it is preserved when it starts with itOther examples:
I'll just leave it here for people to be wary of. And I also made a PR to maybe fix it.I looked through code, whilst trying to understand if that's intended
assuming test case like that
std::string_view layout = R"({{#items}}{{text}} {{#completed}}✓ {{/completed}}{{^completed}}○ {{/completed}} {{/items}})"; TodoList list{ "Mixed Tasks", {{"Task 1", false, "high", "home", 1, 0}, {"Task 2", true, "low", "home", 1, 0}}, true, 2}; auto result = glz::stencil(layout, list); expect(result == "Task 1 ○ Task 2 ✓ ");That passes. the space is preserved inside of
{{completed}}but inside of the{{items}}it is not, however it is preserved when it starts with itOther examples:
I'll just leave it here for people to be wary of.
Beta Was this translation helpful? Give feedback.
All reactions