mirror of
https://github.com/vlang/v.git
synced 2025-09-09 07:15:50 -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' {
|
if node.method_name == 'html' {
|
||||||
f.write('\$vweb.html()')
|
f.write('\$vweb.html()')
|
||||||
} else {
|
} else {
|
||||||
f.write('\$tmpl(${node.args[0].expr})')
|
f.write('\$tmpl(')
|
||||||
|
f.expr(node.args[0].expr)
|
||||||
|
f.write(')')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
match true {
|
match true {
|
||||||
node.is_embed {
|
node.is_embed {
|
||||||
if node.embed_file.compression_type == 'none' {
|
f.write('\$embed_file(')
|
||||||
f.write('\$embed_file(${node.args[0].expr})')
|
f.expr(node.args[0].expr)
|
||||||
} else {
|
if node.embed_file.compression_type != 'none' {
|
||||||
f.write('\$embed_file(${node.args[0].expr}, .${node.embed_file.compression_type})')
|
f.write(', .${node.embed_file.compression_type}')
|
||||||
}
|
}
|
||||||
|
f.write(')')
|
||||||
}
|
}
|
||||||
node.is_env {
|
node.is_env {
|
||||||
f.write("\$env('${node.args_var}')")
|
f.write("\$env('${node.args_var}')")
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import vweb
|
import vweb
|
||||||
|
|
||||||
|
const embedded_file = $embed_file(r'C:\Users\user\path\to\file')
|
||||||
|
|
||||||
struct App {
|
struct App {
|
||||||
a string
|
a string
|
||||||
b string
|
b string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user