Skip to content
This repository has been archived by the owner on Apr 10, 2018. It is now read-only.

fixes #497: document enum values #510

Merged
merged 33 commits into from
Sep 30, 2016
Merged

fixes #497: document enum values #510

merged 33 commits into from
Sep 30, 2016

Conversation

incanus
Copy link
Contributor

@incanus incanus commented Sep 28, 2016

Affects a bunch of downstream stuff which is being documented in #497 proper.

Also removes color operations in 44da3a8 per chat with @samanpwbb since these were cut back in #308.

/cc @jfirebaugh @1ec5

],
"values": {
"map": {
"doc": "When `symbol-placement` is set to `point`, produces icons whose x-axes are aligned east-west."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about symbol-placement = line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, de06217.

],
"values": {
"map": {
"doc": "When `symbol-placement` is set to `point`, produces glyphs whose x-axes are aligned east-west."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

],
"values": {
"==": {
"doc": "The equal-to operator."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's pull in the descriptions from https://www.mapbox.com/mapbox-gl-style-spec/#types-filter for these.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean literally, as in set inclusion: feature[key] ∈ {v0, ..., vn}?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about db47134?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is to use English, for example:

A feature is included when the specified property is one of the specified values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem with just saying “equal-to operator” is that it isn’t clear that the left-hand side must be the property name and the right-hand side must be a property value. Even saying “left” and “right” could be confusing, though, given that the JSON representation is ["==", "key", "value"] rather than ["key", "==", "value"].

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is pretty clear in the context of GL styling, or if not, is very easily fixed (flip things, using the format key == value).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree. Equality is the most straightforward of the operators, but for example describing has as “the existence operator” doesn’t elucidate it for anyone who’s new to filters. How about something like this:

The inequality operator: <var>feature[key]</var> ≠ <var>value</var>.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's what I meant by "pull in the descriptions from https://www.mapbox.com/mapbox-gl-style-spec/#types-filter". I think it would also be good to set up the key and value variables as the existing documentation does:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying this and testing downstream implications in 5848d76.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downstream isn't affected, since we handle filter operators manually in the SDKs. How do you feel about this @1ec5 @jfirebaugh?

"line": {
"doc": "The label is placed along the line of the geometry."
}
},
"default": "point",
"doc": "Label placement relative to its geometry. `line` can only be used on LineStrings and Polygons.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s move the second sentence to the line documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"doc": "The text is aligned to the plane of the viewport."
},
"auto": {
"doc": "Set to the same value as `text-rotation-alignment`."
Copy link
Contributor

@1ec5 1ec5 Sep 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automatically matches the value of text-rotation-alignment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"doc": "The bottom of the text is placed closest to the anchor."
},
"top-left": {
"doc": "The top left side of the text is placed closest to the anchor."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/top left side/top-left corner/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"doc": "The text is not altered."
},
"uppercase": {
"doc": "The text is uppercased."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forces all letters to be displayed in uppercase.

This way there’s no ambiguity about capitalize-style behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"default": "visible",
"doc": "The display of this layer. `none` hides this layer.",
"doc": "The display of this layer.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether this layer is displayed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"doc": "Control whether the translation is relative to the map (north) or viewport (screen)",
"values": {
"map": {
"doc": "The fill is translated relative to the map (north)."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does “north” mean here? Does it mean that a higher y value moves the fill’s origin to the north?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"doc": "The fill is translated relative to the map (north)."
},
"viewport": {
"doc": "The fill is translated relative to the viewport (screen)."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does “screen” mean here? Does it mean that a higher y value moves the fill’s origin up? Or down? (I suppose specifying one or the other would be problematic for platform-specific documentation such as mapbox/mapbox-gl-native#6066, but that isn’t the style specification’s problem.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samanpwbb
Copy link
Contributor

In order to shorten the descriptions, can we cut the "when set to {val}" part of all the descriptions? I don't think it's necessary.

@jfirebaugh
Copy link
Contributor

They're all supposed to read "When symbol-placement is set to...", referring to the behavior of other properties in the presence of symbol-placement. There's a couple of places where "symbol-placement is" is omitted where that's unclear that we should fix, but we can't remove that text entirely.

],
"values": {
"none": {
"doc": "No scaling is performed."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The icon is displayed at its intrinsic aspect ratio." (icon-size can still scale it.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"none": {
"doc": "No scaling is performed."
},
"both": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this the last property, so they are documented in a natural order.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"doc": "Scaling is done in both x- and y-dimensions."
},
"width": {
"doc": "Scaling is done in the x-dimension to fit the text's dimensions."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The icon is scaled in the x-dimension to fit the width of the text."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

],
"values": {
"map": {
"doc": "When `symbol-placement` is set to `point`, produces glyphs whose x-axes are aligned east-west. When set to `line`, produces glyphs whose x-axes are aligned with the line."
Copy link
Contributor

@samanpwbb samanpwbb Sep 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

produces glyphs whose x-axes are aligned east-west

"produces glyphs who x-axes" is unnecessarily techincal. This could benefit from plainer language.

Point: Aligns text east-west.
Line: Places text along corresponding line geometry.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point: Aligns text east-west.

👍

Line: Places text along corresponding line geometry.

There's an important nuance that this doesn't convey; it's the difference between:

    ╱
   ↗
  ╱
 ↗
╱

and

    ╱
   →
  ╱
 →
╱

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@incanus
Copy link
Contributor Author

incanus commented Sep 28, 2016

There's a couple of places where "symbol-placement is" is omitted where that's unclear that we should fix

ca7b446

@incanus
Copy link
Contributor Author

incanus commented Sep 28, 2016

Ready for re-review @1ec5 @jfirebaugh @samanpwbb.

Oops, still need to hit doc generator etc.

@incanus
Copy link
Contributor Author

incanus commented Sep 28, 2016

Doc generator grabbed in 674a1e1.

Do we want to update the page layout now after this? Now we have:

screen shot 2016-09-28 at 4 11 44 pm

However, we don't yet capitalize on our new enum documentation. Should we in this context?

@jfirebaugh
Copy link
Contributor

Yes, let's stick them in a <dl>.

@incanus
Copy link
Contributor Author

incanus commented Sep 29, 2016

Ok, ready for review again. Downstream work is happening in mapbox/mapbox-gl-native#6508 and is looking good as well.

@jfirebaugh
Copy link
Contributor

image

@incanus
Copy link
Contributor Author

incanus commented Sep 29, 2016

@1ec5 Mind re-reviewing and unblocking this?

],
"values": {
"==": {
"doc": "The equality operator."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be any more specific? The equality operator ==, as most programmers know it, allows the left and right sides to be reversed. That isn't the case with any of these operators.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@incanus incanus merged commit 7f62a4f into mb-pages Sep 30, 2016
@incanus incanus deleted the 497-enum-value-docs branch September 30, 2016 21:51
incanus added a commit to mapbox/mapbox-gl-native that referenced this pull request Sep 30, 2016
Documentation for enum values landed in mapbox/mapbox-gl-style-spec#510. 

This updates Android, iOS, and macOS documentation code gen scripts to capitalize on them.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants