accordproject / markdown-transform

Parse and transform markdown text, including TemplateMark markdown templates
Apache License 2.0
73 stars 50 forks source link

Embedded Ergo expressions and/or backticks fail to execute/render #274

Open martinhalford opened 4 years ago

martinhalford commented 4 years ago

Describe the bug Attempting to use backticks within an Ergo expression within a grammar.tem.md. However, when draft command executed, the syntax is passed through to the output.md file in raw, intact form.

Cicero version 0.21.0

To Reproduce

data.json

  "agentPriceEstimateLow" : {
    "$class" : "org.accordproject.money.MonetaryAmount",
    "doubleValue" : 10000,
    "currencyCode" : "AUD"
  },
  "agentPriceEstimateHigh" : {
    "$class" : "org.accordproject.money.MonetaryAmount",
    "doubleValue" : 0,
    "currencyCode" : "AUD"
  }

grammar.tem.md

{{%
    if agentPriceEstimateHigh.doubleValue = 0.0 
    then `Agent Single Price: {{% agentPriceEstimateHigh.currencyCode %}} ${{% agentPriceEstimateHigh.doubleValue as "0,0.0" %}}`
    else `AgentLow Price: {{% agentPriceEstimateHigh.currencyCode %}} ${{% agentPriceEstimateHigh.doubleValue as "0,0.0" %}}`
%}}

Execute cicero draft command.

No error thrown. Simply fails to process syntax.

Expected behaviour String to be rendered according to syntax.

Screenshots image

image

jeromesimeon commented 4 years ago

Thanks @martinhalford . It is an issue with the new parser which does not like % inside a formula (due to a wrong / too constrained regular expression in the template plugin). I'm looking into it.

jeromesimeon commented 4 years ago

This is going to be a slightly tricker issue than expected. For the time being, the work around is to use string concatenation ++ inside Ergo formulas.