From 62c875e01b07197024e3806e8b2882160ce1195c Mon Sep 17 00:00:00 2001 From: Lauren Budorick Date: Mon, 14 May 2018 12:38:14 -0700 Subject: [core] Rework spec function/expression taxonomy Ports https://github.com/mapbox/mapbox-gl-js/pull/6521, updating codegen scripts to parse new expression taxonomy. --- platform/darwin/scripts/generate-style-code.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'platform/darwin/scripts/generate-style-code.js') diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js index c7b54b326a..47106eeac4 100755 --- a/platform/darwin/scripts/generate-style-code.js +++ b/platform/darwin/scripts/generate-style-code.js @@ -318,10 +318,11 @@ global.propertyDoc = function (propertyName, property, layerType, kind) { doc += '* Predefined functions, including mathematical and string operators\n' + '* Conditional expressions\n' + '* Variable assignments and references to assigned variables\n'; - const inputVariable = property.name === 'heatmap-color' ? '$heatmapDensity' : '$zoomLevel'; - if (property["property-function"]) { + const inputVariable = property.expression && property['property-type'] === 'color-ramp' ? + '$' + camelizeWithLeadingLowercase(property.expression.parameters[0]) : '$zoomLevel'; + if (isDataDriven(property)) { doc += `* Interpolation and step functions applied to the \`${inputVariable}\` variable and/or feature attributes\n`; - } else if (property.function === "interpolated") { + } else if (property.expression && property.expression.interpolated) { doc += `* Interpolation and step functions applied to the \`${inputVariable}\` variable\n\n` + 'This property does not support applying interpolation or step functions to feature attributes.'; } else { @@ -332,6 +333,10 @@ global.propertyDoc = function (propertyName, property, layerType, kind) { return doc; }; +global.isDataDriven = function (property) { + return property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven'; +}; + global.propertyReqs = function (property, propertiesByName, type) { return 'This property is only applied to the style if ' + property.requires.map(function (req) { if (typeof req === 'string') { -- cgit v1.2.1 From 0d5a33df677018bc66a40e6fc1f0bf9752d98f52 Mon Sep 17 00:00:00 2001 From: Jordan Kiley Date: Tue, 15 May 2018 10:48:21 -0700 Subject: [ios, macos] Moved numbers away from start of lines in documentation (#11881) --- platform/darwin/scripts/generate-style-code.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'platform/darwin/scripts/generate-style-code.js') diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js index c7b54b326a..e4e4d3dcc1 100755 --- a/platform/darwin/scripts/generate-style-code.js +++ b/platform/darwin/scripts/generate-style-code.js @@ -403,7 +403,7 @@ global.describeValue = function (value, property, layerType) { case 'boolean': return value ? '`YES`' : '`NO`'; case 'number': - return 'the float ' + formatNumber(value); + return 'the float ' + '`' + formatNumber(value) + '`'; case 'string': if (value === '') { return 'the empty string'; -- cgit v1.2.1