diff --git a/autotests/folding/test.mss.fold b/autotests/folding/test.mss.fold --- a/autotests/folding/test.mss.fold +++ b/autotests/folding/test.mss.fold @@ -213,3 +213,63 @@ [zoom >= 11] { line-width: .5; } } } + +#world { + // this syntax + polygon-opacity: 50%; // the parameter “polygon-opacity” gets the value 0.5 (expressed in %) + // is equivalent to + polygon-opacity: 0.5; +} + +/* +Variables behave similar to C macros +*/ +@lsdjkf: @sdlfkj; // this variable gets defined by the value of another variable +@admin-boundaries: #ac46ac; // this variable gets defined by a color value +@way_pixels: "([way_area]*pow(4,@zoom)/24505740000)"; // A rather complex variable. [way_area] marks a data field. @zoom is a special runtime value (inspite of the @ it has nothing to do with ordinary variables) + +/* This is +a multiline comment. +*/ + +// A single line comment +#admin-low-zoom[zoom < 11], // A single line comment +#admin-mid-zoom[zoom >= 11][zoom < 13] { + [admin_level = '2'], // Within filters, data fields like “admin_level” are referended without extra [] brackets. + [admin_level = '3'] { // These data fields are rendered by default in dark blue, while the data field within expression strings are rendered by default in light blue. + [zoom >= 4] { + background/line-color: white; // symbolizer named “background” + background/line-width: 0.6; // symbolizer named “background” + line-color: @admin-boundaries; // default symbolizer (without name) + name: [test]; // simplified reference to the data field “test” + name: "[test]"; // another reference to the data field “test”, this time within an expression string (by default orange) + name: "([way_area]*pow(4,@zoom)/24505740000)"; // a rather complex expression string that will do some math + name: "'Value: '[test]"; // A verbatim string (by default red) as part of an expression string + name: '"Value: "[test]'; // " and ' are interchangable. The outer is always the expression string and the inner the verbatim string. + } + } + [admin_level = '4'] { // The string '4' is red because at this position it will be interpreted as a verbatim string, not as an expression string. + [zoom >= 4] { + line-dasharray: 4,3; // parameter “line-dasharray” gets as value a list of two integers + line-clip: false; // parameter “line-clip” gets as value a boolean + } + } + comp-op: darken; // parameter “comp-op” gets as value “darken”. +} + +.nature-reserve-boundaries { // .nature-reserve-boudaries references a class, which is similar to a layer like #building-text, so both are rendered the same way + [way_pixels > 100][zoom >= 7] { // Here zoom is a keyword with results in a special filter. However, all other values are interpreted as data fields. + [zoom < 10] { + ::fill { // The :: syntax defined “attachments” (a sort of sub-layer within normal layers). So “fill” is rendered by default in the same style like layer names and class names (but this can be customized). + opacity: 0.05; + // various styles to define colors (all except the color function are rendered the same way): + polygon-fill: white; + polygon-fill: #ffffff; + polygon-fill: #fff; + polygon-fill: rgba(255,255,255,1); // define a color by a speciel function + polygon-fill: #ffff; // invalid color value + text-placement: interior; // all unknown values are hightlighted as named values. + } + } + } +} diff --git a/autotests/html/test.mss.html b/autotests/html/test.mss.html --- a/autotests/html/test.mss.html +++ b/autotests/html/test.mss.html @@ -11,69 +11,69 @@ katepart highlighting engine. */ -#world { +#world { // this syntax -polygon-opacity: 50%; +polygon-opacity: 50%; // is equivalent to -polygon-opacity: 0.5; -} +polygon-opacity: 0.5; +} -@admin-boundaries: #ac46ac; +@admin-boundaries: #ac46ac; /* For performance reasons, the admin border layers are split into three groups for low, middle and high zoom levels. For each zoomlevel, all borders come from a single attachment, to handle overlapping borders correctly. */ -#admin-low-zoom[zoom < 11], // test -#admin-mid-zoom[zoom >= 11][zoom < 13], -#admin-high-zoom[zoom >= 13] { - [admin_level = '2'], - [admin_level = '3'] { - [zoom >= 4] { - background/line-color: white; - background/line-width: 0.6; - line-color: @admin-boundaries; - line-width: 0.6; - } - [zoom >= 7] { - background/line-width: 2; - line-width: 2; - } - [zoom >= 10] { - [admin_level = '2'] { - background/line-width: 6; - line-width: 6; - } - [admin_level = '3'] { - background/line-width: 5; - line-width: 5; - line-dasharray: 4,2; - line-clip: false; - } - } - } - [admin_level = '4'] { - [zoom >= 4] { - background/line-color: white; - background/line-width: 0.6; - line-color: @admin-boundaries; - line-width: 0.6; - line-dasharray: 4,3; - line-clip: false; - } - [zoom >= 7] { - background/line-width: 1; - line-width: 1; - } - [zoom >= 11] { - background/line-width: 3; - line-width: 3; - } - } - /* +#admin-low-zoom[zoom < 11], // test +#admin-mid-zoom[zoom >= 11][zoom < 13], +#admin-high-zoom[zoom >= 13] { + [admin_level = '2'], + [admin_level = '3'] { + [zoom >= 4] { + background/line-color: white; + background/line-width: 0.6; + line-color: @admin-boundaries; + line-width: 0.6; + } + [zoom >= 7] { + background/line-width: 2; + line-width: 2; + } + [zoom >= 10] { + [admin_level = '2'] { + background/line-width: 6; + line-width: 6; + } + [admin_level = '3'] { + background/line-width: 5; + line-width: 5; + line-dasharray: 4,2; + line-clip: false; + } + } + } + [admin_level = '4'] { + [zoom >= 4] { + background/line-color: white; + background/line-width: 0.6; + line-color: @admin-boundaries; + line-width: 0.6; + line-dasharray: 4,3; + line-clip: false; + } + [zoom >= 7] { + background/line-width: 1; + line-width: 1; + } + [zoom >= 11] { + background/line-width: 3; + line-width: 3; + } + } + /* The following code prevents admin boundaries from being rendered on top of each other. Comp-op works on the entire attachment, not on the individual border. Therefore, this code generates an attachment containing a set of @@ -84,139 +84,199 @@ The SQL has `ORDER BY admin_level`, so the boundary with the lowest admin_level is rendered on top, and therefore the only visible boundary. */ - opacity: 0.4; - comp-op: darken; -} - -#admin-mid-zoom[zoom >= 11][zoom < 13], -#admin-high-zoom[zoom >= 13] { - [admin_level = '5'][zoom >= 11] { - background/line-color: white; - background/line-width: 2; - line-color: @admin-boundaries; - line-width: 2; - line-dasharray: 6,3,2,3,2,3; - line-clip: false; - } - [admin_level = '6'][zoom >= 11] { - background/line-color: white; - background/line-width: 2; - line-color: @admin-boundaries; - line-width: 2; - line-dasharray: 6,3,2,3; - line-clip: false; - } - [admin_level = '7'], - [admin_level = '8'] { - [zoom >= 12] { - background/line-color: white; - background/line-width: 1.5; - line-color: @admin-boundaries; - line-width: 1.5; - line-dasharray: 5,2; - line-clip: false; - } - } - opacity: 0.5; - comp-op: darken; -} - -#admin-high-zoom[zoom >= 13] { - [admin_level = '9'], - [admin_level = '10'] { - [zoom >= 13] { - background/line-color: white; - background/line-width: 2; - line-color: @admin-boundaries; - line-width: 2; - line-dasharray: 2,3; - line-clip: false; - } - } - opacity: 0.5; - comp-op: darken; -} - - - -#nature-reserve-boundaries { - [way_pixels > 100][zoom >= 7] { - [zoom < 10] { - ::fill { - opacity: 0.05; - polygon-fill: green; - } - } - a/line-width: 1; - a/line-offset: -0.5; - a/line-color: green; - a/line-opacity: 0.15; - a/line-join: round; - a/line-cap: round; - b/line-width: 2; - b/line-offset: -1; - b/line-color: green; - b/line-opacity: 0.15; - b/line-join: round; - b/line-cap: round; - [zoom >= 10] { - a/line-width: 2; - a/line-offset: -1; - b/line-width: 4; - b/line-offset: -2; - } - [zoom >= 14] { - b/line-width: 6; - b/line-offset: -3; - } - } -} - -#building-text { -[zoom >= 14][way_pixels > 3000], -[zoom >= 17] { -text-name: "[name]"; -text-size: 11; -text-fill: #444; -text-face-name: @book-fonts; -text-halo-radius: 1; -text-wrap-width: 20; -text-halo-fill: rgba(255,255,255,0.5); -text-placement: interior; -} -} - -@marina-text: #576ddf; // also swimming_pool -@landcover-face-name: @oblique-fonts; -@standard-wrap-width: 30; - -.points { - [feature = 'tourism_alpine_hut'][zoom >= 13] { - point-file: url('symbols/alpinehut.p.16.png'); - point-placement: interior; - } - } - - [feature = 'highway_bus_stop'] { - [zoom >= 16] { - marker-file: url('symbols/square.svg'); - marker-fill: @transportation-icon; - marker-placement: interior; - marker-width: 6; - } - [zoom >= 17] { - marker-file: url('symbols/bus_stop.p.12.png'); - marker-width: 12; - } - } - -[feature = 'highway_primary'] { -[zoom >= 7][zoom < 12] { -line-width: 0.5; -line-color: @primary-fill; -[zoom >= 9] { line-width: 1.2; } -[zoom >= 10] { line-width: 2; } -[zoom >= 11] { line-width: .5; } -} -} + opacity: 0.4; + comp-op: darken; +} + +#admin-mid-zoom[zoom >= 11][zoom < 13], +#admin-high-zoom[zoom >= 13] { + [admin_level = '5'][zoom >= 11] { + background/line-color: white; + background/line-width: 2; + line-color: @admin-boundaries; + line-width: 2; + line-dasharray: 6,3,2,3,2,3; + line-clip: false; + } + [admin_level = '6'][zoom >= 11] { + background/line-color: white; + background/line-width: 2; + line-color: @admin-boundaries; + line-width: 2; + line-dasharray: 6,3,2,3; + line-clip: false; + } + [admin_level = '7'], + [admin_level = '8'] { + [zoom >= 12] { + background/line-color: white; + background/line-width: 1.5; + line-color: @admin-boundaries; + line-width: 1.5; + line-dasharray: 5,2; + line-clip: false; + } + } + opacity: 0.5; + comp-op: darken; +} + +#admin-high-zoom[zoom >= 13] { + [admin_level = '9'], + [admin_level = '10'] { + [zoom >= 13] { + background/line-color: white; + background/line-width: 2; + line-color: @admin-boundaries; + line-width: 2; + line-dasharray: 2,3; + line-clip: false; + } + } + opacity: 0.5; + comp-op: darken; +} + + + +#nature-reserve-boundaries { + [way_pixels > 100][zoom >= 7] { + [zoom < 10] { + ::fill { + opacity: 0.05; + polygon-fill: green; + } + } + a/line-width: 1; + a/line-offset: -0.5; + a/line-color: green; + a/line-opacity: 0.15; + a/line-join: round; + a/line-cap: round; + b/line-width: 2; + b/line-offset: -1; + b/line-color: green; + b/line-opacity: 0.15; + b/line-join: round; + b/line-cap: round; + [zoom >= 10] { + a/line-width: 2; + a/line-offset: -1; + b/line-width: 4; + b/line-offset: -2; + } + [zoom >= 14] { + b/line-width: 6; + b/line-offset: -3; + } + } +} + +#building-text { +[zoom >= 14][way_pixels > 3000], +[zoom >= 17] { +text-name: "[name]"; +text-size: 11; +text-fill: #444; +text-face-name: @book-fonts; +text-halo-radius: 1; +text-wrap-width: 20; +text-halo-fill: rgba(255,255,255,0.5); +text-placement: interior; +} +} + +@marina-text: #576ddf; // also swimming_pool +@landcover-face-name: @oblique-fonts; +@standard-wrap-width: 30; + +.points { + [feature = 'tourism_alpine_hut'][zoom >= 13] { + point-file: url('symbols/alpinehut.p.16.png'); + point-placement: interior; + } + } + + [feature = 'highway_bus_stop'] { + [zoom >= 16] { + marker-file: url('symbols/square.svg'); + marker-fill: @transportation-icon; + marker-placement: interior; + marker-width: 6; + } + [zoom >= 17] { + marker-file: url('symbols/bus_stop.p.12.png'); + marker-width: 12; + } + } + +[feature = 'highway_primary'] { +[zoom >= 7][zoom < 12] { +line-width: 0.5; +line-color: @primary-fill; +[zoom >= 9] { line-width: 1.2; } +[zoom >= 10] { line-width: 2; } +[zoom >= 11] { line-width: .5; } +} +} + +#world { + // this syntax + polygon-opacity: 50%; // the parameter “polygon-opacity” gets the value 0.5 (expressed in %) + // is equivalent to + polygon-opacity: 0.5; +} + +/* +Variables behave similar to C macros +*/ +@lsdjkf: @sdlfkj; // this variable gets defined by the value of another variable +@admin-boundaries: #ac46ac; // this variable gets defined by a color value +@way_pixels: "([way_area]*pow(4,@zoom)/24505740000)"; // A rather complex variable. [way_area] marks a data field. @zoom is a special runtime value (inspite of the @ it has nothing to do with ordinary variables) + +/* This is +a multiline comment. +*/ + +// A single line comment +#admin-low-zoom[zoom < 11], // A single line comment +#admin-mid-zoom[zoom >= 11][zoom < 13] { + [admin_level = '2'], // Within filters, data fields like “admin_level” are referended without extra [] brackets. + [admin_level = '3'] { // These data fields are rendered by default in dark blue, while the data field within expression strings are rendered by default in light blue. + [zoom >= 4] { + background/line-color: white; // symbolizer named “background” + background/line-width: 0.6; // symbolizer named “background” + line-color: @admin-boundaries; // default symbolizer (without name) + name: [test]; // simplified reference to the data field “test” + name: "[test]"; // another reference to the data field “test”, this time within an expression string (by default orange) + name: "([way_area]*pow(4,@zoom)/24505740000)"; // a rather complex expression string that will do some math + name: "'Value: '[test]"; // A verbatim string (by default red) as part of an expression string + name: '"Value: "[test]'; // " and ' are interchangable. The outer is always the expression string and the inner the verbatim string. + } + } + [admin_level = '4'] { // The string '4' is red because at this position it will be interpreted as a verbatim string, not as an expression string. + [zoom >= 4] { + line-dasharray: 4,3; // parameter “line-dasharray” gets as value a list of two integers + line-clip: false; // parameter “line-clip” gets as value a boolean + } + } + comp-op: darken; // parameter “comp-op” gets as value “darken”. +} + +.nature-reserve-boundaries { // .nature-reserve-boudaries references a class, which is similar to a layer like #building-text, so both are rendered the same way + [way_pixels > 100][zoom >= 7] { // Here zoom is a keyword with results in a special filter. However, all other values are interpreted as data fields. + [zoom < 10] { + ::fill { // The :: syntax defined “attachments” (a sort of sub-layer within normal layers). So “fill” is rendered by default in the same style like layer names and class names (but this can be customized). + opacity: 0.05; + // various styles to define colors (all except the color function are rendered the same way): + polygon-fill: white; + polygon-fill: #ffffff; + polygon-fill: #fff; + polygon-fill: rgba(255,255,255,1); // define a color by a speciel function + polygon-fill: #ffff; // invalid color value + text-placement: interior; // all unknown values are hightlighted as named values. + } + } + } +} diff --git a/autotests/input/test.mss b/autotests/input/test.mss --- a/autotests/input/test.mss +++ b/autotests/input/test.mss @@ -213,3 +213,63 @@ [zoom >= 11] { line-width: .5; } } } + +#world { + // this syntax + polygon-opacity: 50%; // the parameter “polygon-opacity” gets the value 0.5 (expressed in %) + // is equivalent to + polygon-opacity: 0.5; +} + +/* +Variables behave similar to C macros +*/ +@lsdjkf: @sdlfkj; // this variable gets defined by the value of another variable +@admin-boundaries: #ac46ac; // this variable gets defined by a color value +@way_pixels: "([way_area]*pow(4,@zoom)/24505740000)"; // A rather complex variable. [way_area] marks a data field. @zoom is a special runtime value (inspite of the @ it has nothing to do with ordinary variables) + +/* This is +a multiline comment. +*/ + +// A single line comment +#admin-low-zoom[zoom < 11], // A single line comment +#admin-mid-zoom[zoom >= 11][zoom < 13] { + [admin_level = '2'], // Within filters, data fields like “admin_level” are referended without extra [] brackets. + [admin_level = '3'] { // These data fields are rendered by default in dark blue, while the data field within expression strings are rendered by default in light blue. + [zoom >= 4] { + background/line-color: white; // symbolizer named “background” + background/line-width: 0.6; // symbolizer named “background” + line-color: @admin-boundaries; // default symbolizer (without name) + name: [test]; // simplified reference to the data field “test” + name: "[test]"; // another reference to the data field “test”, this time within an expression string (by default orange) + name: "([way_area]*pow(4,@zoom)/24505740000)"; // a rather complex expression string that will do some math + name: "'Value: '[test]"; // A verbatim string (by default red) as part of an expression string + name: '"Value: "[test]'; // " and ' are interchangable. The outer is always the expression string and the inner the verbatim string. + } + } + [admin_level = '4'] { // The string '4' is red because at this position it will be interpreted as a verbatim string, not as an expression string. + [zoom >= 4] { + line-dasharray: 4,3; // parameter “line-dasharray” gets as value a list of two integers + line-clip: false; // parameter “line-clip” gets as value a boolean + } + } + comp-op: darken; // parameter “comp-op” gets as value “darken”. +} + +.nature-reserve-boundaries { // .nature-reserve-boudaries references a class, which is similar to a layer like #building-text, so both are rendered the same way + [way_pixels > 100][zoom >= 7] { // Here zoom is a keyword with results in a special filter. However, all other values are interpreted as data fields. + [zoom < 10] { + ::fill { // The :: syntax defined “attachments” (a sort of sub-layer within normal layers). So “fill” is rendered by default in the same style like layer names and class names (but this can be customized). + opacity: 0.05; + // various styles to define colors (all except the color function are rendered the same way): + polygon-fill: white; + polygon-fill: #ffffff; + polygon-fill: #fff; + polygon-fill: rgba(255,255,255,1); // define a color by a speciel function + polygon-fill: #ffff; // invalid color value + text-placement: interior; // all unknown values are hightlighted as named values. + } + } + } +} diff --git a/autotests/reference/test.mss.ref b/autotests/reference/test.mss.ref --- a/autotests/reference/test.mss.ref +++ b/autotests/reference/test.mss.ref @@ -4,70 +4,70 @@ with CC0 license. This file is just for testing
katepart highlighting engine.
*/
-
-#world {
+
+#world {
// this syntax
-polygon-opacity: 50%;
-
+polygon-opacity: 50%;
+
// is equivalent to
-polygon-opacity: 0.5;
+polygon-opacity: 0.5;
}
-
-@admin-boundaries: #ac46ac;
-
+
+@admin-boundaries: #ac46ac;
+
/* For performance reasons, the admin border layers are split into three groups
for low, middle and high zoom levels.
For each zoomlevel, all borders come from a single attachment, to handle
overlapping borders correctly.
*/
-
-#admin-low-zoom[zoom < 11], // test
-#admin-mid-zoom[zoom >= 11][zoom < 13],
-#admin-high-zoom[zoom >= 13] {
- [admin_level = '2'],
- [admin_level = '3'] {
- [zoom >= 4] {
- background/line-color: white;
- background/line-width: 0.6;
- line-color: @admin-boundaries;
- line-width: 0.6;
- }
- [zoom >= 7] {
- background/line-width: 2;
- line-width: 2;
- }
- [zoom >= 10] {
- [admin_level = '2'] {
- background/line-width: 6;
- line-width: 6;
- }
- [admin_level = '3'] {
- background/line-width: 5;
- line-width: 5;
- line-dasharray: 4,2;
- line-clip: false;
- }
- }
- }
- [admin_level = '4'] {
- [zoom >= 4] {
- background/line-color: white;
- background/line-width: 0.6;
- line-color: @admin-boundaries;
- line-width: 0.6;
- line-dasharray: 4,3;
- line-clip: false;
- }
- [zoom >= 7] {
- background/line-width: 1;
- line-width: 1;
- }
- [zoom >= 11] {
- background/line-width: 3;
- line-width: 3;
- }
- }
- /*
+
+#admin-low-zoom[zoom < 11], // test
+#admin-mid-zoom[zoom >= 11][zoom < 13],
+#admin-high-zoom[zoom >= 13] {
+ [admin_level = '2'],
+ [admin_level = '3'] {
+ [zoom >= 4] {
+ background/line-color: white;
+ background/line-width: 0.6;
+ line-color: @admin-boundaries;
+ line-width: 0.6;
+ }
+ [zoom >= 7] {
+ background/line-width: 2;
+ line-width: 2;
+ }
+ [zoom >= 10] {
+ [admin_level = '2'] {
+ background/line-width: 6;
+ line-width: 6;
+ }
+ [admin_level = '3'] {
+ background/line-width: 5;
+ line-width: 5;
+ line-dasharray: 4,2;
+ line-clip: false;
+ }
+ }
+ }
+ [admin_level = '4'] {
+ [zoom >= 4] {
+ background/line-color: white;
+ background/line-width: 0.6;
+ line-color: @admin-boundaries;
+ line-width: 0.6;
+ line-dasharray: 4,3;
+ line-clip: false;
+ }
+ [zoom >= 7] {
+ background/line-width: 1;
+ line-width: 1;
+ }
+ [zoom >= 11] {
+ background/line-width: 3;
+ line-width: 3;
+ }
+ }
+ /*
The following code prevents admin boundaries from being rendered on top of
each other. Comp-op works on the entire attachment, not on the individual
border. Therefore, this code generates an attachment containing a set of
@@ -78,138 +78,198 @@ The SQL has `ORDER BY admin_level`, so the boundary with the lowest
admin_level is rendered on top, and therefore the only visible boundary.
*/
- opacity: 0.4;
- comp-op: darken;
+ opacity: 0.4;
+ comp-op: darken;
}
-
-#admin-mid-zoom[zoom >= 11][zoom < 13],
-#admin-high-zoom[zoom >= 13] {
- [admin_level = '5'][zoom >= 11] {
- background/line-color: white;
- background/line-width: 2;
- line-color: @admin-boundaries;
- line-width: 2;
- line-dasharray: 6,3,2,3,2,3;
- line-clip: false;
- }
- [admin_level = '6'][zoom >= 11] {
- background/line-color: white;
- background/line-width: 2;
- line-color: @admin-boundaries;
- line-width: 2;
- line-dasharray: 6,3,2,3;
- line-clip: false;
- }
- [admin_level = '7'],
- [admin_level = '8'] {
- [zoom >= 12] {
- background/line-color: white;
- background/line-width: 1.5;
- line-color: @admin-boundaries;
- line-width: 1.5;
- line-dasharray: 5,2;
- line-clip: false;
- }
- }
- opacity: 0.5;
- comp-op: darken;
+
+#admin-mid-zoom[zoom >= 11][zoom < 13],
+#admin-high-zoom[zoom >= 13] {
+ [admin_level = '5'][zoom >= 11] {
+ background/line-color: white;
+ background/line-width: 2;
+ line-color: @admin-boundaries;
+ line-width: 2;
+ line-dasharray: 6,3,2,3,2,3;
+ line-clip: false;
+ }
+ [admin_level = '6'][zoom >= 11] {
+ background/line-color: white;
+ background/line-width: 2;
+ line-color: @admin-boundaries;
+ line-width: 2;
+ line-dasharray: 6,3,2,3;
+ line-clip: false;
+ }
+ [admin_level = '7'],
+ [admin_level = '8'] {
+ [zoom >= 12] {
+ background/line-color: white;
+ background/line-width: 1.5;
+ line-color: @admin-boundaries;
+ line-width: 1.5;
+ line-dasharray: 5,2;
+ line-clip: false;
+ }
+ }
+ opacity: 0.5;
+ comp-op: darken;
}
-
-#admin-high-zoom[zoom >= 13] {
- [admin_level = '9'],
- [admin_level = '10'] {
- [zoom >= 13] {
- background/line-color: white;
- background/line-width: 2;
- line-color: @admin-boundaries;
- line-width: 2;
- line-dasharray: 2,3;
- line-clip: false;
- }
- }
- opacity: 0.5;
- comp-op: darken;
+
+#admin-high-zoom[zoom >= 13] {
+ [admin_level = '9'],
+ [admin_level = '10'] {
+ [zoom >= 13] {
+ background/line-color: white;
+ background/line-width: 2;
+ line-color: @admin-boundaries;
+ line-width: 2;
+ line-dasharray: 2,3;
+ line-clip: false;
+ }
+ }
+ opacity: 0.5;
+ comp-op: darken;
}
-
-
-
-#nature-reserve-boundaries {
- [way_pixels > 100][zoom >= 7] {
- [zoom < 10] {
- ::fill {
- opacity: 0.05;
- polygon-fill: green;
- }
- }
- a/line-width: 1;
- a/line-offset: -0.5;
- a/line-color: green;
- a/line-opacity: 0.15;
- a/line-join: round;
- a/line-cap: round;
- b/line-width: 2;
- b/line-offset: -1;
- b/line-color: green;
- b/line-opacity: 0.15;
- b/line-join: round;
- b/line-cap: round;
- [zoom >= 10] {
- a/line-width: 2;
- a/line-offset: -1;
- b/line-width: 4;
- b/line-offset: -2;
- }
- [zoom >= 14] {
- b/line-width: 6;
- b/line-offset: -3;
- }
- }
+
+
+
+#nature-reserve-boundaries {
+ [way_pixels > 100][zoom >= 7] {
+ [zoom < 10] {
+ ::fill {
+ opacity: 0.05;
+ polygon-fill: green;
+ }
+ }
+ a/line-width: 1;
+ a/line-offset: -0.5;
+ a/line-color: green;
+ a/line-opacity: 0.15;
+ a/line-join: round;
+ a/line-cap: round;
+ b/line-width: 2;
+ b/line-offset: -1;
+ b/line-color: green;
+ b/line-opacity: 0.15;
+ b/line-join: round;
+ b/line-cap: round;
+ [zoom >= 10] {
+ a/line-width: 2;
+ a/line-offset: -1;
+ b/line-width: 4;
+ b/line-offset: -2;
+ }
+ [zoom >= 14] {
+ b/line-width: 6;
+ b/line-offset: -3;
+ }
+ }
}
-
-#building-text {
-[zoom >= 14][way_pixels > 3000],
-[zoom >= 17] {
-text-name: "[name]";
-text-size: 11;
-text-fill: #444;
-text-face-name: @book-fonts;
-text-halo-radius: 1;
-text-wrap-width: 20;
-text-halo-fill: rgba(255,255,255,0.5);
-text-placement: interior;
+
+#building-text {
+[zoom >= 14][way_pixels > 3000],
+[zoom >= 17] {
+text-name: "[name]";
+text-size: 11;
+text-fill: #444;
+text-face-name: @book-fonts;
+text-halo-radius: 1;
+text-wrap-width: 20;
+text-halo-fill: rgba(255,255,255,0.5);
+text-placement: interior;
}
}
-
-@marina-text: #576ddf; // also swimming_pool
-@landcover-face-name: @oblique-fonts;
-@standard-wrap-width: 30;
-
-.points {
- [feature = 'tourism_alpine_hut'][zoom >= 13] {
- point-file: url('symbols/alpinehut.p.16.png');
- point-placement: interior;
- }
- }
-
- [feature = 'highway_bus_stop'] {
- [zoom >= 16] {
- marker-file: url('symbols/square.svg');
- marker-fill: @transportation-icon;
- marker-placement: interior;
- marker-width: 6;
- }
- [zoom >= 17] {
- marker-file: url('symbols/bus_stop.p.12.png');
- marker-width: 12;
- }
- }
-
-[feature = 'highway_primary'] {
-[zoom >= 7][zoom < 12] {
-line-width: 0.5;
-line-color: @primary-fill;
-[zoom >= 9] { line-width: 1.2; }
-[zoom >= 10] { line-width: 2; }
-[zoom >= 11] { line-width: .5; }
+
+@marina-text: #576ddf; // also swimming_pool
+@landcover-face-name: @oblique-fonts;
+@standard-wrap-width: 30;
+
+.points {
+ [feature = 'tourism_alpine_hut'][zoom >= 13] {
+ point-file: url('symbols/alpinehut.p.16.png');
+ point-placement: interior;
+ }
+ }
+
+ [feature = 'highway_bus_stop'] {
+ [zoom >= 16] {
+ marker-file: url('symbols/square.svg');
+ marker-fill: @transportation-icon;
+ marker-placement: interior;
+ marker-width: 6;
+ }
+ [zoom >= 17] {
+ marker-file: url('symbols/bus_stop.p.12.png');
+ marker-width: 12;
+ }
+ }
+
+[feature = 'highway_primary'] {
+[zoom >= 7][zoom < 12] {
+line-width: 0.5;
+line-color: @primary-fill;
+[zoom >= 9] { line-width: 1.2; }
+[zoom >= 10] { line-width: 2; }
+[zoom >= 11] { line-width: .5; }
}
}
+
+#world {
+ // this syntax
+ polygon-opacity: 50%; // the parameter “polygon-opacity” gets the value 0.5 (expressed in %)
+ // is equivalent to
+ polygon-opacity: 0.5;
+}
+
+/*
+Variables behave similar to C macros
+*/
+@lsdjkf: @sdlfkj; // this variable gets defined by the value of another variable
+@admin-boundaries: #ac46ac; // this variable gets defined by a color value
+@way_pixels: "([way_area]*pow(4,@zoom)/24505740000)"; // A rather complex variable. [way_area] marks a data field. @zoom is a special runtime value (inspite of the @ it has nothing to do with ordinary variables)
+
+/* This is
+a multiline comment.
+*/
+
+// A single line comment
+#admin-low-zoom[zoom < 11], // A single line comment
+#admin-mid-zoom[zoom >= 11][zoom < 13] {
+ [admin_level = '2'], // Within filters, data fields like “admin_level” are referended without extra [] brackets.
+ [admin_level = '3'] { // These data fields are rendered by default in dark blue, while the data field within expression strings are rendered by default in light blue.
+ [zoom >= 4] {
+ background/line-color: white; // symbolizer named “background”
+ background/line-width: 0.6; // symbolizer named “background”
+ line-color: @admin-boundaries; // default symbolizer (without name)
+ name: [test]; // simplified reference to the data field “test”
+ name: "[test]"; // another reference to the data field “test”, this time within an expression string (by default orange)
+ name: "([way_area]*pow(4,@zoom)/24505740000)"; // a rather complex expression string that will do some math
+ name: "'Value: '[test]"; // A verbatim string (by default red) as part of an expression string
+ name: '"Value: "[test]'; // " and ' are interchangable. The outer is always the expression string and the inner the verbatim string.
+ }
+ }
+ [admin_level = '4'] { // The string '4' is red because at this position it will be interpreted as a verbatim string, not as an expression string.
+ [zoom >= 4] {
+ line-dasharray: 4,3; // parameter “line-dasharray” gets as value a list of two integers
+ line-clip: false; // parameter “line-clip” gets as value a boolean
+ }
+ }
+ comp-op: darken; // parameter “comp-op” gets as value “darken”.
+}
+
+.nature-reserve-boundaries { // .nature-reserve-boudaries references a class, which is similar to a layer like #building-text, so both are rendered the same way
+ [way_pixels > 100][zoom >= 7] { // Here zoom is a keyword with results in a special filter. However, all other values are interpreted as data fields.
+ [zoom < 10] {
+ ::fill { // The :: syntax defined “attachments” (a sort of sub-layer within normal layers). So “fill” is rendered by default in the same style like layer names and class names (but this can be customized).
+ opacity: 0.05;
+ // various styles to define colors (all except the color function are rendered the same way):
+ polygon-fill: white;
+ polygon-fill: #ffffff;
+ polygon-fill: #fff;
+ polygon-fill: rgba(255,255,255,1); // define a color by a speciel function
+ polygon-fill: #ffff; // invalid color value
+ text-placement: interior; // all unknown values are hightlighted as named values.
+ }
+ }
+ }
+}
diff --git a/data/syntax/carto-css.xml b/data/syntax/carto-css.xml --- a/data/syntax/carto-css.xml +++ b/data/syntax/carto-css.xml @@ -1,371 +1,230 @@  - + - + - - - true - false - + - - AliceBlue - AntiqueWhite - Aqua - Aquamarine - Azure - Beige - Bisque - Black - BlanchedAlmond - Blue - BlueViolet - Brown - BurlyWood - CadetBlue - Chartreuse - Chocolate - Coral - CornflowerBlue - Cornsilk - Crimson - Cyan - DarkBlue - DarkCyan - DarkGoldenRod - DarkGray - DarkGreen - DarkKhaki - DarkMagenta - DarkOliveGreen - DarkOrange - DarkOrchid - DarkRed - DarkSalmon - DarkSeaGreen - DarkSlateBlue - DarkSlateGray - DarkTurquoise - DarkViolet - DeepPink - DeepSkyBlue - DimGray - DodgerBlue - FireBrick - FloralWhite - ForestGreen - Fuchsia - Gainsboro - GhostWhite - Gold - GoldenRod - Gray - Green - GreenYellow - HoneyDew - HotPink - IndianRed - Indigo - Ivory - Khaki - Lavender - LavenderBlush - LawnGreen - LemonChiffon - LightBlue - LightCoral - LightCyan - LightGoldenRodYellow - LightGray - LightGreen - LightPink - LightSalmon - LightSeaGreen - LightSkyBlue - LightSlateGray - LightSteelBlue - LightYellow - Lime - LimeGreen - Linen - Magenta - Maroon - MediumAquaMarine - MediumBlue - MediumOrchid - MediumPurple - MediumSeaGreen - MediumSlateBlue - MediumSpringGreen - MediumTurquoise - MediumVioletRed - MidnightBlue - MintCream - MistyRose - Moccasin - NavajoWhite - Navy - OldLace - Olive - OliveDrab - Orange - OrangeRed - Orchid - PaleGoldenRod - PaleGreen - PaleTurquoise - PaleVioletRed - PapayaWhip - PeachPuff - Peru - Pink - Plum - PowderBlue - Purple - Red - RosyBrown - RoyalBlue - SaddleBrown - Salmon - SandyBrown - SeaGreen - SeaShell - Sienna - Silver - SkyBlue - SlateBlue - SlateGray - Snow - SpringGreen - SteelBlue - Tan - Teal - Thistle - Tomato - Turquoise - Violet - Wheat - White - WhiteSmoke - Yellow - YellowGreen + + + aliceblue + antiquewhite + aqua + aquamarine + azure + beige + bisque + black + blanchedalmond + blue + blueviolet + brown + burlywood + cadetblue + chartreuse + chocolate + coral + cornflowerblue + cornsilk + crimson + cyan + darkblue + darkcyan + darkgoldenrod + darkgray + darkgreen + darkgrey + darkkhaki + darkmagenta + darkolivegreen + darkorange + darkorchid + darkred + darksalmon + darkseagreen + darkslateblue + darkslategrey + darkturquoise + darkviolet + deeppink + deepskyblue + dimgray + dimgrey + dodgerblue + firebrick + floralwhite + forestgreen + fuchsia + gainsboro + ghostwhite + gold + goldenrod + gray + grey + green + greenyellow + honeydew + hotpink + indianred + indigo + ivory + khaki + lavender + lavenderblush + lawngreen + lemonchiffon + lightblue + lightcoral + lightcyan + lightgoldenrodyellow + lightgray + lightgreen + lightgrey + lightpink + lightsalmon + lightseagreen + lightskyblue + lightslategray + lightslategrey + lightsteelblue + lightyellow + lime + limegreen + linen + magenta + maroon + mediumaquamarine + mediumblue + mediumorchid + mediumpurple + mediumseagreen + mediumslateblue + mediumspringgreen + mediumturquoise + mediumvioletred + midnightblue + mintcream + mistyrose + moccasin + navajowhite + navy + oldlace + olive + olivedrab + orange + orangered + orchid + palegoldenrod + palegreen + paleturquoise + palevioletred + papayawhip + peachpuff + peru + pink + plum + powderblue + purple + red + rosybrown + royalblue + saddlebrown + salmon + sandybrown + seagreen + seashell + sienna + silver + skyblue + slateblue + slategray + slategrey + snow + springgreen + steelblue + tan + teal + thistle + tomato + turquoise + violet + wheat + white + whitesmoke + yellow + yellowgreen + transparent - - - - line-clip - line-pattern-clip - marker-allow-overlap - marker-clip - marker-ignore-placement - point-allow-overlap - point-ignore-placement - polygon-clip - polygon-pattern-clip - shield-allow-overlap - shield-avoid-edges - shield-clip - shield-unlock-image - shield-wrap-before - text-allow-overlap - text-avoid-edges - text-clip - - - building-fill - line-color - background-color - marker-fill - marker-line-color - polygon-fill - raster-colorizer-default-color - shield-fill - shield-halo-fill - text-fill - text-halo-fill - - - building-height - marker-height - marker-width - shield-name - text-name - text-orientation - - - opacity - building-fill-opacity - line-gamma - line-miterlimit - line-offset - line-opacity - line-simplify - line-smooth - line-width - line-pattern-offset - line-pattern-simplify - line-pattern-smooth - background-image-opacity - buffer-size - marker-fill-opacity - marker-line-opacity - marker-line-width - marker-max-error - marker-opacity - marker-smooth - marker-spacing - point-opacity - polygon-gamma - polygon-opacity - polygon-simplify - polygon-smooth - polygon-pattern-gamma - polygon-pattern-opacity - polygon-pattern-simplify - polygon-pattern-smooth - raster-colorizer-epsilon - raster-filter-factor - raster-opacity - shield-dx - shield-dy - shield-halo-radius - shield-min-distance - shield-min-padding - shield-opacity - shield-size - shield-spacing - shield-text-dx - shield-text-dy - shield-text-opacity - text-character-spacing - text-dx - text-dy - text-halo-radius - text-max-char-angle-delta - text-min-distance - text-min-padding - text-min-path-length - text-opacity - text-size - - - direct-image-filters - image-filters - line-geometry-transform - line-pattern-geometry-transform - marker-geometry-transform - marker-transform - point-transform - polygon-geometry-transform - polygon-pattern-geometry-transform - shield-transform - - - comp-op - line-cap - line-comp-op - line-gamma-method - line-join - line-rasterizer - line-simplify-algorithm - line-pattern-comp-op - line-pattern-simplify-algorithm - background-image-comp-op - marker-comp-op - marker-multi-policy - marker-placement - marker-type - point-comp-op - point-placement - polygon-comp-op - polygon-gamma-method - polygon-simplify-algorithm - polygon-pattern-alignment - polygon-pattern-comp-op - polygon-pattern-simplify-algorithm - raster-colorizer-default-mode - raster-comp-op - raster-scaling - shield-comp-op - shield-horizontal-alignment - shield-justify-alignment - shield-placement - shield-placement-type - shield-text-transform - shield-vertical-alignment - text-align - text-comp-op - text-halo-rasterizer - text-horizontal-alignment - text-placement - text-placement-type - text-transform - text-vertical-alignment - - - line-dash-offset - line-dasharray - - - debug-mode - base - srs - shield-face-name - shield-placements - shield-wrap-character - text-face-name - text-placements - text-wrap-character + - - raster-colorizer-stops + + + + + + + + + + + + + + - - raster-mesh-size - shield-character-spacing - shield-line-spacing - shield-wrap-width - text-label-position-tolerance - text-line-spacing - text-ratio - text-spacing - text-wrap-width + + + + + + + + + + + + + + + - - line-pattern-file - background-image - font-directory - marker-file - point-file - polygon-pattern-file - shield-file + + + + + + + + + + - + + + - + + + - - + - - - - - - - + + + + - - - - + + + @@ -377,29 +236,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - + + + + + + + + - + - +