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

反义符导致 比较难受的bug #234

Open
h4acda opened this issue Sep 20, 2024 · 8 comments
Open

反义符导致 比较难受的bug #234

h4acda opened this issue Sep 20, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@h4acda
Copy link

h4acda commented Sep 20, 2024

Describe the issue

反义符 导致 无法渲染 变量

Vapor version

4.4.0

Operating system and version

macOS 15.0

Swift version

6.0

Steps to reproduce

在leaf文件中 输入:Hello\#(name) 应该输出Hello\World 可是如果有\就会导致无法识别name 这是个非常严重的BUG了 目的就是输出Hello\World 请正面解决 不要以自定义标签等代替方案

Outcome

No response

Additional notes

No response

@h4acda h4acda added the bug Something isn't working label Sep 20, 2024
@h4acda
Copy link
Author

h4acda commented Sep 20, 2024

实际示例 test.leaf 文件内容为
<?php namespace app\#(app)\controller#(app);
渲染数据为
req.view.render("test", renderData(app: "admin"))
struct renderData: Content, Encodable { let app: String }
渲染后为<?php namespace app\#(app)\controlleradmin;
第一个#(app)无法渲染
因该为<?php namespace app\admin\controlleradmin;
由于返回为代码 所以希望解决一下这个问题

@h4acda
Copy link
Author

h4acda commented Sep 20, 2024

#if(menu.controller_name.contains("/")):
use app\controller\Admin;
#endif 请问如何判断menu.controller_name是否包含"/"

@0xTim
Copy link
Member

0xTim commented Oct 10, 2024

\ is an escape character in Leaf, I think you need \\#(app)

@h4acda
Copy link
Author

h4acda commented Oct 10, 2024

感谢您的回复 \#(app)渲染的也不对

@0xTim
Copy link
Member

0xTim commented Nov 27, 2024

With the double \\? What does it render?

@h4acda
Copy link
Author

h4acda commented Nov 27, 2024

\#(app) 渲染成 #(app) 无法渲染 app

@h4acda
Copy link
Author

h4acda commented Nov 27, 2024

Hello\#(name) 应该为Hello\World 您可以尝试一下 \#(xxx) 这种

@h4acda
Copy link
Author

h4acda commented Nov 27, 2024

\\#(app)也是错误的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants