mirror of
https://github.com/vlang/v.git
synced 2025-09-08 23:07:19 -04:00
fmt: respect raw strings in $embed_file(r'/some/path')
expressions (#19753)
This commit is contained in:
parent
3957bd801d
commit
df8863a08a
@ -2066,16 +2066,19 @@ pub fn (mut f Fmt) comptime_call(node ast.ComptimeCall) {
|
||||
if node.method_name == 'html' {
|
||||
f.write('\$vweb.html()')
|
||||
} else {
|
||||
f.write('\$tmpl(${node.args[0].expr})')
|
||||
f.write('\$tmpl(')
|
||||
f.expr(node.args[0].expr)
|
||||
f.write(')')
|
||||
}
|
||||
} else {
|
||||
match true {
|
||||
node.is_embed {
|
||||
if node.embed_file.compression_type == 'none' {
|
||||
f.write('\$embed_file(${node.args[0].expr})')
|
||||
} else {
|
||||
f.write('\$embed_file(${node.args[0].expr}, .${node.embed_file.compression_type})')
|
||||
f.write('\$embed_file(')
|
||||
f.expr(node.args[0].expr)
|
||||
if node.embed_file.compression_type != 'none' {
|
||||
f.write(', .${node.embed_file.compression_type}')
|
||||
}
|
||||
f.write(')')
|
||||
}
|
||||
node.is_env {
|
||||
f.write("\$env('${node.args_var}')")
|
||||
|
@ -1,5 +1,7 @@
|
||||
import vweb
|
||||
|
||||
const embedded_file = $embed_file(r'C:\Users\user\path\to\file')
|
||||
|
||||
struct App {
|
||||
a string
|
||||
b string
|
||||
|
Loading…
x
Reference in New Issue
Block a user