【发布时间】:2018-07-02 21:08:56
【问题描述】:
场景
在我的应用程序中,我使用 Razor.Parse<>(). 将文本、链接和标签解析为 HTML
string Razor.Parse<TEmail>(string razorTemplate, TEmail model) where TEmail : BaseEmail
我使用'@' 解析来自model 的数据。我也解析网页链接。此功能运行良好,直到我解析 Google Map 链接,例如
问题 https://www.google.com/maps/place/New+York,+NY,+USA/@40.6974034,-74.1197634,11z/data=!3m1!4b1!4m5!3m4!1s0x89c24fa5d33f083b:0xc80b8f06e177fe62!8m2!3d40.7127753!4d-74.0059728 链接包括“@”。所以我得到错误:
RazorEngine.Templating.TemplateParsingException: '"40.6974034" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{" are valid.'
我的尝试
我尝试用 dobule @@ 解析 html https://www.google.com/maps/place/New+York,+NY,+USA/@@40.6974034,-74.1197634,11z/data=!3m1!4b1!4m5!3m4!1s0x89c24fa5d33f083b:0xc80b8f06e177fe62!8m2!3d40.7127753!4d-74.0059728 但我得到错误:
RazorEngine.Templating.TemplateParsingException: '"@" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{" are valid.'
知道我能做什么吗?谢谢你
【问题讨论】: