Skip to content

Commit

Permalink
autorepair: do not repair "out" in "South Carolina"
Browse files Browse the repository at this point in the history
  • Loading branch information
simon04 committed Jun 12, 2024
1 parent be0f345 commit bee7a10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/autorepair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ export default function autorepair(q, lng) {
"$1xml$3/*fixed by auto repair*/"
);
// 2. fix print statements: non meta output, overpass geometries
const prints = q.match(/(\.([^;.]+?)\s+)?(out[^:;"\]]*;)/g) || [];
const prints = q.match(/(\.([^;.]+?)\s+)?(\bout\b[^:;"\]]*;)/g) || [];
for (const print_i of prints) {
// eslint-disable-next-line prefer-const
let [print, , out_set, out_statement] = print_i.match(
/(\.([^;.]+?)\s+)?(out[^:;"\]]*;)/
/(\.([^;.]+?)\s+)?(\bout[^:;"\]]*;)/
);
let new_print = print;
let new_out_statement;
Expand Down
4 changes: 4 additions & 0 deletions tests/test.autorepair.josm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ describe("ide.autorepair.josm", () => {
// more complex real world example
inp: '/*bla*/\n[out:xml];\nway\n ["amenity"]\n ({{bbox}})\n->.foo;\n.foo out qt;',
outp: '/*bla*/\n[out:xml];\nway\n ["amenity"]\n ({{bbox}})\n->.foo;\n.foo out meta qt;/*fixed by auto repair*/'
},
{
inp: "{{geocodeArea:South Carolina}}->.searchArea;",
outp: "{{geocodeArea:South Carolina}}->.searchArea;"
}
];
vi.spyOn(ide, "getQueryLang").mockImplementation(() => "OverpassQL");
Expand Down

0 comments on commit bee7a10

Please sign in to comment.