Permalink
Browse files

Fix Data scheme bug, update tests

  • Loading branch information...
1 parent 032c3d5 commit bcccd2d4ec06155c9c87b29b44117ad8875a0638 @tmcw tmcw committed Dec 19, 2013
View
@@ -7,3 +7,11 @@ usage:
--simplestyle
enable simplestyle icon translation
+ --name
+ property for <name>
+ --description
+ property for <description>
+ --documentName
+ property for document <name>
+ --documentDescription
+ property for document <description>
View
@@ -126,7 +126,7 @@ function extendeddata(_) {
}
function data(_) {
- return tag('Data', encode(_[1]), [['name', encode(_[0])]]);
+ return tag('Data', tag('value', encode(_[1])), [['name', encode(_[0])]]);
}
// ## Icons
View
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><Point><coordinates>100,0</coordinates></Point><ExtendedData><Data name="prop0">&lt;h1&gt;test&lt;/h1&gt;</Data><Data name="&lt;h1&gt;prop1&lt;/h1&gt;">val2</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><Point><coordinates>100,0</coordinates></Point><ExtendedData><Data name="prop0"><value>&lt;h1&gt;test&lt;/h1&gt;</value></Data><Data name="&lt;h1&gt;prop1&lt;/h1&gt;"><value>val2</value></Data></ExtendedData></Placemark></Document></kml>
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><Point><coordinates>102,0.5</coordinates></Point><ExtendedData><Data name="prop0">value0</Data></ExtendedData></Placemark><Placemark><LineString><coordinates>102,0 103,1 104,0 105,1</coordinates></LineString><ExtendedData><Data name="prop0">value0</Data><Data name="prop1">0</Data></ExtendedData></Placemark><Placemark><Polygon><outerBoundaryIs><LinearRing><coordinates>100,0 101,0 101,1 100,1 100,0</coordinates></LinearRing></outerBoundaryIs></Polygon><ExtendedData><Data name="prop0">value0</Data><Data name="prop1">val2</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><Point><coordinates>102,0.5</coordinates></Point><ExtendedData><Data name="prop0"><value>value0</value></Data></ExtendedData></Placemark><Placemark><LineString><coordinates>102,0 103,1 104,0 105,1</coordinates></LineString><ExtendedData><Data name="prop0"><value>value0</value></Data><Data name="prop1"><value>0</value></Data></ExtendedData></Placemark><Placemark><Polygon><outerBoundaryIs><LinearRing><coordinates>100,0 101,0 101,1 100,1 100,0</coordinates></LinearRing></outerBoundaryIs></Polygon><ExtendedData><Data name="prop0"><value>value0</value></Data><Data name="prop1"><value>val2</value></Data></ExtendedData></Placemark></Document></kml>
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><MultiGeometry><Point><coordinates>100,0</coordinates></Point><LineString><coordinates>101,0 102,1</coordinates></LineString></MultiGeometry><ExtendedData><Data name="prop0">value0</Data><Data name="prop1">val2</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><MultiGeometry><Point><coordinates>100,0</coordinates></Point><LineString><coordinates>101,0 102,1</coordinates></LineString></MultiGeometry><ExtendedData><Data name="prop0"><value>value0</value></Data><Data name="prop1"><value>val2</value></Data></ExtendedData></Placemark></Document></kml>
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><LineString><coordinates>100,0 101,1</coordinates></LineString><ExtendedData><Data name="prop0">value0</Data><Data name="prop1">val2</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><LineString><coordinates>100,0 101,1</coordinates></LineString><ExtendedData><Data name="prop0"><value>value0</value></Data><Data name="prop1"><value>val2</value></Data></ExtendedData></Placemark></Document></kml>
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><MultiGeometry><LineString><coordinates>100,0 101,1</coordinates></LineString><LineString><coordinates>102,2 103,3</coordinates></LineString></MultiGeometry><ExtendedData><Data name="prop0">value0</Data><Data name="prop1">val2</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><MultiGeometry><LineString><coordinates>100,0 101,1</coordinates></LineString><LineString><coordinates>102,2 103,3</coordinates></LineString></MultiGeometry><ExtendedData><Data name="prop0"><value>value0</value></Data><Data name="prop1"><value>val2</value></Data></ExtendedData></Placemark></Document></kml>
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><MultiGeometry><Point><coordinates>100,0</coordinates></Point><Point><coordinates>101,1</coordinates></Point></MultiGeometry><ExtendedData><Data name="prop0">value0</Data><Data name="prop1">val2</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><MultiGeometry><Point><coordinates>100,0</coordinates></Point><Point><coordinates>101,1</coordinates></Point></MultiGeometry><ExtendedData><Data name="prop0"><value>value0</value></Data><Data name="prop1"><value>val2</value></Data></ExtendedData></Placemark></Document></kml>
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>102,2 103,2 103,3 102,3 102,2</coordinates></LinearRing></outerBoundaryIs></Polygon><Polygon><outerBoundaryIs><LinearRing><coordinates>100,0 101,0 101,1 100,1 100,0</coordinates></LinearRing></outerBoundaryIs><innerBoundaryIs><LinearRing><coordinates>100.2,0.2 100.8,0.2 100.8,0.8 100.2,0.8 100.2,0.2</coordinates></LinearRing></innerBoundaryIs></Polygon></MultiGeometry><ExtendedData><Data name="prop0">value0</Data><Data name="prop1">val2</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>102,2 103,2 103,3 102,3 102,2</coordinates></LinearRing></outerBoundaryIs></Polygon><Polygon><outerBoundaryIs><LinearRing><coordinates>100,0 101,0 101,1 100,1 100,0</coordinates></LinearRing></outerBoundaryIs><innerBoundaryIs><LinearRing><coordinates>100.2,0.2 100.8,0.2 100.8,0.8 100.2,0.8 100.2,0.2</coordinates></LinearRing></innerBoundaryIs></Polygon></MultiGeometry><ExtendedData><Data name="prop0"><value>value0</value></Data><Data name="prop1"><value>val2</value></Data></ExtendedData></Placemark></Document></kml>
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><name>Fox</name><description>A hound</description><Point><coordinates>100,0</coordinates></Point><ExtendedData><Data name="name">Fox</Data><Data name="description">A hound</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><name>Fox</name><description>A hound</description><Point><coordinates>100,0</coordinates></Point><ExtendedData><Data name="name"><value>Fox</value></Data><Data name="description"><value>A hound</value></Data></ExtendedData></Placemark></Document></kml>
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><Point><coordinates>0,0</coordinates></Point><ExtendedData><Data name="prop0"></Data><Data name="prop1">val2</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><Point><coordinates>0,0</coordinates></Point><ExtendedData><Data name="prop0"><value></value></Data><Data name="prop1"><value>val2</value></Data></ExtendedData></Placemark></Document></kml>
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><name>Fox</name><description>A hound</description><Point><coordinates>100,0</coordinates></Point><ExtendedData><Data name="name">Fox</Data><Data name="description">A hound</Data><Data name="count">4</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><name>Fox</name><description>A hound</description><Point><coordinates>100,0</coordinates></Point><ExtendedData><Data name="name"><value>Fox</value></Data><Data name="description"><value>A hound</value></Data><Data name="count"><value>4</value></Data></ExtendedData></Placemark></Document></kml>
View
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><Point><coordinates>100,0</coordinates></Point><ExtendedData><Data name="prop0">value0</Data><Data name="prop1">val2</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><Point><coordinates>100,0</coordinates></Point><ExtendedData><Data name="prop0"><value>value0</value></Data><Data name="prop1"><value>val2</value></Data></ExtendedData></Placemark></Document></kml>
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><Polygon><outerBoundaryIs><LinearRing><coordinates>100,0 101,0 101,1 100,1 100,0</coordinates></LinearRing></outerBoundaryIs></Polygon><ExtendedData><Data name="prop0">value0</Data><Data name="prop1">val2</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><Polygon><outerBoundaryIs><LinearRing><coordinates>100,0 101,0 101,1 100,1 100,0</coordinates></LinearRing></outerBoundaryIs></Polygon><ExtendedData><Data name="prop0"><value>value0</value></Data><Data name="prop1"><value>val2</value></Data></ExtendedData></Placemark></Document></kml>
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Style id="busacemedium"><IconStyle><Icon><href>https://api.tiles.mapbox.com/v3/marker/pin-m-bus+ace.png</href></Icon></IconStyle><hotSpot xunits="fraction" yunits="fraction" x="0.5" y="0.5"></hotSpot></Style><Placemark><Point><coordinates>0,0</coordinates></Point><ExtendedData><Data name="marker-shape">pin</Data><Data name="marker-size">medium</Data><Data name="marker-symbol">bus</Data><Data name="marker-color">#ace</Data></ExtendedData><styleUrl>#busacemedium</styleUrl></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Style id="busacemedium"><IconStyle><Icon><href>https://api.tiles.mapbox.com/v3/marker/pin-m-bus+ace.png</href></Icon></IconStyle><hotSpot xunits="fraction" yunits="fraction" x="0.5" y="0.5"></hotSpot></Style><Placemark><Point><coordinates>0,0</coordinates></Point><ExtendedData><Data name="marker-shape"><value>pin</value></Data><Data name="marker-size"><value>medium</value></Data><Data name="marker-symbol"><value>bus</value></Data><Data name="marker-color"><value>#ace</value></Data></ExtendedData><styleUrl>#busacemedium</styleUrl></Placemark></Document></kml>
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><Point><coordinates>102,0.5</coordinates></Point><ExtendedData><Data name="prop0">value0</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><Point><coordinates>102,0.5</coordinates></Point><ExtendedData><Data name="prop0"><value>value0</value></Data></ExtendedData></Placemark></Document></kml>
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><ExtendedData><Data name="prop0">value0</Data><Data name="prop1">val2</Data></ExtendedData></Placemark></Document></kml>
+<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Placemark><ExtendedData><Data name="prop0"><value>value0</value></Data><Data name="prop1"><value>val2</value></Data></ExtendedData></Placemark></Document></kml>
View
@@ -17,7 +17,5 @@ if (process.stdin.isTTY && !argv._[0]) {
(argv._.length ? fs.createReadStream(argv._[0]) : process.stdin).pipe(concat(convert));
function convert(data) {
- process.stdout.write(tokml(JSON.parse(data), {
- simplestyle: simplestyle
- }));
+ process.stdout.write(tokml(JSON.parse(data), argv));
}

0 comments on commit bcccd2d

Please sign in to comment.