summaryrefslogtreecommitdiff
path: root/platform/darwin/scripts/generate-style-code.js
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-08-18 02:23:40 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-08-19 14:20:27 -0700
commit938540b9192b55f2cc524db83fe7ff96504ac699 (patch)
tree8ca1cc0a96e137f58a97ce3bed977d4dd110977a /platform/darwin/scripts/generate-style-code.js
parente6ed9cd63876962efc7432f6ff34012fc0fe815b (diff)
downloadqtlocation-mapboxgl-938540b9192b55f2cc524db83fe7ff96504ac699.tar.gz
[ios, macos] Specify units
Replaced pixels with points in documentation.
Diffstat (limited to 'platform/darwin/scripts/generate-style-code.js')
-rw-r--r--platform/darwin/scripts/generate-style-code.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js
index c84332a7b3..a99a0182a9 100644
--- a/platform/darwin/scripts/generate-style-code.js
+++ b/platform/darwin/scripts/generate-style-code.js
@@ -98,7 +98,15 @@ global.propertyDoc = function (property, layerType) {
}
return '`' + symbol + '`';
});
- return doc;
+ if ('units' in property) {
+ if (!property.units.match(/s$/)) {
+ property.units += 's';
+ }
+ doc += `
+
+ This property is measured in ${property.units}.`;
+ }
+ return doc.replace(/(p)ixel/gi, '$1oint').replace(/(\d)px\b/g, '$1pt');
};
global.parseColor = function (str) {
@@ -140,14 +148,18 @@ global.propertyDefault = function (property, layerType) {
}
return 'an `NSColor` or `UIColor`' + `object whose RGB value is ${color.r}, ${color.g}, ${color.b} and whose alpha value is ${color.a}`;
case 'array':
+ let units = property.units || '';
+ if (units) {
+ units = ` ${units}`.replace(/pixel/, 'point');
+ }
if (property.name.indexOf('padding') !== -1) {
//if (property.default.reduce((a, b) => a + b, 0) === 0) {
// return '`NSEdgeInsetsZero` or `UIEdgeInsetsZero`';
//}
- return `${property.default[0]} on the top, ${property.default[1]} on the right, ${property.default[2]} on the bottom, and ${property.default[3]} on the left`;
+ return `${property.default[0]}${units} on the top, ${property.default[1]}${units} on the right, ${property.default[2]}${units} on the bottom, and ${property.default[3]}${units} on the left`;
}
if (property.name.indexOf('offset') !== -1 || property.name.indexOf('translate') !== -1) {
- return `${property.default[0]} from the left and ${property.default[1]} from the top`;
+ return `${property.default[0]}${units} from the left and ${property.default[1]}${units} from the top`;
}
return '`' + property.default.join('`, `') + '`';
default: