Skip to content

Block Expressions throw exception if Markdown syntax detected. #316

Description

@martinhalford

Describe the bug
Block Expressions throw an error if markdown syntax detected within block.

To Reproduce
Consider the following grammar...

{{#if rebateEntitled}} 
The agent will be, or is likely to be, receiving a rebate or rebates.
{{else}} 
The agent will not be, or is not likely to be, entitled to any rebate in respect of\
...any outgoings; or\
...any prepayments made by a person engaging or appointing the agent (the client) in respect of any intended expenditure by the agent on the client's behalf; or\
...any payments made by the client to another person in respect of the work.
{{/if}}

The above renders fine.

Now consider the following grammar...

This is a contract
{{#if rebateEntitled}} 
The agent will be, or is likely to be, receiving a rebate or rebates.
{{else}} 
The agent will not be, or is not likely to be, entitled to any rebate in respect of\
- any outgoings; or\
- any prepayments made by a person engaging or appointing the agent (the client) in respect of any intended expenditure by the agent on the client's behalf; or\
- any payments made by the client to another person in respect of the work.
{{/if}}
This is more text

The above fails with error: Cannot read property 'length' of undefined due to the - chars which are interpreted as unordered list syntax.

Now consider the following grammar...

{{#if rebateEntitled}} 
The agent will be, or is likely to be, receiving a rebate or rebates.
{{else}} 
The agent will not be, or is not likely to be, entitled to any rebate in respect of\

...any outgoings; or\
...any prepayments made by a person engaging or appointing the agent (the client) in respect of any intended expenditure by the agent on the client's behalf; or\
...any payments made by the client to another person in respect of the work.
{{/if}}

The above fails with error: Cannot read property 'length' of undefined due to the blank line within the {{else}} block.

Expected behavior
Expect the Conditional block to consider all chars, that are not part of the Block syntax, be treated as plain text and no error be thrown.

Similarly, expect the new / blank line to be treated as plain text and/or converted to a hardline break (e.g. \) and not throw an error.

Version
Cicero v0.21.5

Additional context
ifelse.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions