File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -160,15 +160,22 @@ def get_string(self):
160160 options .append (f"default={ val } " )
161161 if array_sep :
162162 options .append (f'sep="{ array_sep } "' )
163- if true or false :
163+ is_flag = true or false
164+ if is_flag :
164165 options .append (f'true="{ true if true else "" } "' )
165166 options .append (f'false="{ false if false else "" } "' )
166167
167168 stroptions = "" .join (o + " " for o in options )
168169
169- if self .optional and not default :
170+ if self .optional and not default and not is_flag :
170171 prewithquotes = f'"{ bc } " + ' if bc .strip () else ""
171- return f"~{{{ stroptions } { prewithquotes } { name } }}"
172+ # Option 1: We apply quotes are value, Option 2: We quote whole "prefix + name" combo
173+ full_token = (
174+ f"{ prewithquotes } '\" ' + { name } + '\" '"
175+ if (self .separate and self .prefix and prewithquotes )
176+ else f"'\" ' + { prewithquotes } { name } + '\" '"
177+ )
178+ return f'~{{{ stroptions } if defined({ name } ) then ({ full_token } ) else ""}}'
172179 else :
173180 return bc + f"~{{{ stroptions } { name } }}"
174181
You can’t perform that action at this time.
0 commit comments