11local S = minetest .get_translator (" travelnet" )
2+ local F = minetest .formspec_escape
23
34local player_formspec_data = travelnet .player_formspec_data
45
@@ -30,8 +31,8 @@ function travelnet.formspecs.error_message(options)
3031 button[3.5,2.5;1.0,0.5;back;%s]
3132 button[6.8,2.5;1.0,0.5;station_exit;%s]
3233 ]] ):format (
33- minetest . formspec_escape (options .title or S (" Error" )),
34- minetest . formspec_escape (options .message or " - nothing -" ),
34+ F (options .title or S (" Error" )),
35+ F (options .message or " - nothing -" ),
3536 S (" Back" ),
3637 S (" Exit" )
3738 )
@@ -56,17 +57,17 @@ function travelnet.formspecs.edit_travelnet(options)
5657 S (" Configure this travelnet station" ),
5758 S (" Remove station" ),
5859 S (" Name of this station:" ),
59- minetest . formspec_escape (options .station_name or " " ),
60+ F (options .station_name or " " ),
6061 S (" What do you call this place here? Example: \" my first house\" , \" mine\" , \" shop\" ..." ),
6162 S (" Assign to network:" ),
62- minetest . formspec_escape (
63+ F (
6364 travelnet .is_falsey_string (options .station_network )
6465 and travelnet .default_network
6566 or options .station_network
6667 ),
6768 S (" You can have more than one network. If unsure, use \" @1\" ." , travelnet .default_network ),
6869 S (" Owned by:" ),
69- minetest . formspec_escape (options .owner_name or " " ),
70+ F (options .owner_name or " " ),
7071 S (" Unless you know what you are doing, leave this as is." ),
7172 S (" Save" ),
7273 S (" Exit" )
@@ -86,7 +87,7 @@ function travelnet.formspecs.edit_elevator(options)
8687 S (" Configure this elevator station" ),
8788 S (" Remove station" ),
8889 S (" Name of this station:" ),
89- minetest . formspec_escape (options .station_name ),
90+ F (options .station_name ),
9091 S (" Save" ),
9192 S (" Exit" )
9293 )
@@ -110,11 +111,11 @@ function travelnet.formspecs.primary(options, player_name)
110111 tostring (options .height or 10 ),
111112 options .is_elevator and S (" Elevator:" ) or S (" Travelnet-Box:" ),
112113 S (" Name of this station:" ),
113- minetest . formspec_escape (options .station_name or " ?" ),
114+ F (options .station_name or " ?" ),
114115 S (" Assigned to Network:" ),
115- minetest . formspec_escape (options .station_network or " ?" ),
116+ F (options .station_network or " ?" ),
116117 S (" Owned by:" ),
117- minetest . formspec_escape (options .owner_name or " ?" ),
118+ F (options .owner_name or " ?" ),
118119 S (" Click on target to travel there:" ),
119120 S (" Exit" )
120121 )
@@ -165,7 +166,7 @@ function travelnet.formspecs.primary(options, player_name)
165166 if k == options .station_name then
166167 formspec = formspec ..
167168 (" button[%f,%f;1,0.5;open_door;<>]label[%f,%f;%s]" )
168- :format (x , y + 2.5 , x + 0.9 , y + 2.35 , k )
169+ :format (x , y + 2.5 , x + 0.9 , y + 2.35 , F ( k ) )
169170 elseif options .is_elevator then
170171 local travelnets = travelnet .get_travelnets (options .owner_name )
171172 local network = travelnets [options .station_network ]
@@ -178,11 +179,11 @@ function travelnet.formspecs.primary(options, player_name)
178179
179180 formspec = formspec ..
180181 (" button[%f,%f;1,0.5;target;%s]label[%f,%f;%s]" )
181- :format (x , y + 2.5 , minetest . formspec_escape (tostring (network [k ].nr )), x + 0.9 , y + 2.35 , k )
182+ :format (x , y + 2.5 , F (tostring (network [k ].nr )), x + 0.9 , y + 2.35 , F ( k ) )
182183 else
183184 formspec = formspec ..
184185 (" button[%f,%f;4,0.5;target;%s]" )
185- :format (x , y + 2.5 , minetest . formspec_escape (k ))
186+ :format (x , y + 2.5 , F (k ))
186187 end
187188
188189 y = y + 1
@@ -215,19 +216,19 @@ function travelnet.formspecs.primary(options, player_name)
215216
216217 if paging then
217218 if page_number > 2 then
218- formspec = formspec .. (" button[0,9.2;2,1;first_page;%s]" ):format (minetest . formspec_escape (S (" <<" )))
219+ formspec = formspec .. (" button[0,9.2;2,1;first_page;%s]" ):format (F (S (" <<" )))
219220 end
220221 if page_number > 1 then
221- formspec = formspec .. (" button[2,9.2;2,1;prev_page;%s]" ):format (minetest . formspec_escape (S (" <" )))
222+ formspec = formspec .. (" button[2,9.2;2,1;prev_page;%s]" ):format (F (S (" <" )))
222223 end
223224 formspec = formspec
224- .. (" label[5,9.4;%s]" ):format (minetest . formspec_escape (S (" Page @1/@2" , page_number , pages )))
225+ .. (" label[5,9.4;%s]" ):format (F (S (" Page @1/@2" , page_number , pages )))
225226 .. (" field[20,20;0.1,0.1;page_number;Page;%i]" ):format (page_number )
226227 if page_number < pages then
227- formspec = formspec .. (" button[8,9.2;2,1;next_page;%s]" ):format (minetest . formspec_escape (S (" >" )))
228+ formspec = formspec .. (" button[8,9.2;2,1;next_page;%s]" ):format (F (S (" >" )))
228229 end
229230 if page_number < pages - 1 then
230- formspec = formspec .. (" button[10,9.2;2,1;last_page;%s]" ):format (minetest . formspec_escape (S (" >>" )))
231+ formspec = formspec .. (" button[10,9.2;2,1;last_page;%s]" ):format (F (S (" >>" )))
231232 end
232233 end
233234
0 commit comments