mapshaper 0.5.74 → 0.5.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/www/modules.js CHANGED
@@ -12464,8 +12464,9 @@ function wkt_parse(str) {
12464
12464
  // WKT format: http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#11
12465
12465
  function wkt_unpack(str) {
12466
12466
  var obj;
12467
- // Convert WKT escaped quote to JSON escaped quote
12468
- str = str.replace(/""/g, '\\"');
12467
+ // Convert WKT escaped quotes to JSON escaped quotes
12468
+ // str = str.replace(/""/g, '\\"'); // BUGGY
12469
+ str = convert_wkt_quotes(str);
12469
12470
 
12470
12471
  // Convert WKT entities to JSON arrays
12471
12472
  str = str.replace(/([A-Z0-9]+)\[/g, '["$1",');
@@ -12487,6 +12488,23 @@ function wkt_unpack(str) {
12487
12488
  return obj;
12488
12489
  }
12489
12490
 
12491
+ // Convert WKT escaped quotes to JSON escaped quotes ("" -> \")
12492
+ function convert_wkt_quotes(str) {
12493
+ var c = 0;
12494
+ return str.replace(/"+/g, function(s) {
12495
+ var even = c % 2 == 0;
12496
+ c += s.length;
12497
+ // ordinary, unescaped quotes
12498
+ if (s == '"' || s == '""' && even) return s;
12499
+ // WKT-escaped quotes
12500
+ if (even) {
12501
+ return '"' + s.substring(1).replace(/""/g, '\\"');
12502
+ } else {
12503
+ return s.replace(/""/g, '\\"');
12504
+ }
12505
+ });
12506
+ }
12507
+
12490
12508
  // Rearrange a subarray of a parsed WKT file for easier traversal
12491
12509
  // E.g.
12492
12510
  // ["WGS84", ...] to {NAME: "WGS84"}
@@ -21706,6 +21724,7 @@ api.internal = {
21706
21724
  RAD_TO_DEG: RAD_TO_DEG,
21707
21725
  wkt_parse: wkt_parse,
21708
21726
  wkt_unpack: wkt_unpack,
21727
+ convert_wkt_quotes: convert_wkt_quotes,
21709
21728
  wkt_to_proj4: wkt_to_proj4,
21710
21729
  wkt_from_proj4: wkt_from_proj4,
21711
21730
  wkt_make_projcs: wkt_make_projcs,
package/www/page.css CHANGED
@@ -32,7 +32,7 @@ html, body {
32
32
  body {
33
33
  overflow: hidden;
34
34
  background-color: #fff;
35
- font: 14px/1.4 'Source Sans Pro', Helvetica, sans-serif;
35
+ font: 14px/1.4 'Source Sans Pro', Arial, sans-serif;
36
36
  color: #444;
37
37
  user-select: none;
38
38
  -webkit-user-select: none;