slim-template / slim

Slim is a template language whose goal is to reduce the syntax to the essential parts without becoming cryptic.
https://slim-template.github.io
MIT License
5.29k stars 500 forks source link

Allow whitespace markers for verbatim text: `|<`, `|>`, and `|<>` #912

Closed UweKubosch closed 1 year ago

UweKubosch commented 1 year ago

Fixes #882

UweKubosch commented 1 year ago

Looks good?

minad commented 1 year ago

Looks good at first sight. I will test this soon.

minad commented 1 year ago

The only thing which worries me is if someone uses |<tag>. We should probably require a whitespace after the |<. Otherwise we could potentially break some use cases. What do you think?

UweKubosch commented 1 year ago

Hmm, yes, that is a use case we need to decide on. For compatibility |<tag> needs to work, right? I can add it as a special case.

UweKubosch commented 1 year ago

I added a test case with a verbatim text starting with a tag without a dividing space, and I changed the parser to handle it as before. This means that verbatim text with pipe and whitespace markers requires a dividing space before the content.

It think it makes sense and handles backwards compatibility.

I am not sure I have caught all variants of indentation, but all existing tests are green. What might be missing is handling of indentation with whitespace markers.

minad commented 1 year ago

Thanks. I let this rest for a few days and take another closer look.

What might be missing is handling of indentation with whitespace markers.

Yes, can you please add tests for that too? Maybe we also need tests for |><? Do we test this for the other line indicators too? In any case it makes sense to add more tests.

UweKubosch commented 1 year ago

Thanks. I let this rest for a few days and take another closer look.

What might be missing is handling of indentation with whitespace markers.

Yes, can you please add tests for that too? Maybe we also need tests for |><? Do we test this for the other line indicators too? In any case it makes sense to add more tests.

OK, added test case for both |>< and indented block with whitespace markers. Hope this makes it complete.