Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update LG escape #3614

Merged
merged 16 commits into from
Mar 25, 2020
Merged

update LG escape #3614

merged 16 commits into from
Mar 25, 2020

Conversation

Danieladu
Copy link
Collaborator

@Danieladu Danieladu commented Mar 23, 2020

close: #3549
update LG escape policy to make LG achieve higher robustness.

the new strategy of LG evaluation about escape characters is as below:

  • in any case, \n, \r, \t, \\ would be unescaped.
  • in normal text condition, \$ would be unescaped to $
  • in structured value condition, \| would be unescaped to |
  • other characters that have \ prefix, would leave it as is

Examples

Simple samples

lg template result
ab\ncd ab [newline] cd
ab\${cd} ab${cd}
ab\ycd ab\ycd
ab\"cd ab\"cd
ab\'cd ab\'cd

Structure LG sample

# template
[struct
   list=a|b\|c
]  

would get:

{
    "lgType": "struct",
    "list":[
        "a",
        "b|c"
    ]
}

json sample

# template
- ${json(cardjson()).text}

# cardjson
- ``` {
    "text":"Your meeting about \"Adaptive Card design session\""
}```

would get the string result -> Your meeting about "Adaptive Card design session"

fromFile sample

# template
- ${json(fromFile('a.txt')).text}

and the content of 1.txt is

{
    "text":"Your meeting about \"Adaptive Card design session\""
}

would get the same string result -> Your meeting about "Adaptive Card design session"

@Danieladu Danieladu requested review from chrimc62, tomlm and boydc2014 and removed request for chrimc62 March 23, 2020 09:52
@boydc2014
Copy link
Contributor

Can you add some test case around \\| in structured lg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[AdaptiveExpressions] json() does not escape correctly
3 participants