Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Improve in expression example #664

Closed
wants to merge 1 commit into from
Closed

Conversation

tordans
Copy link

@tordans tordans commented May 15, 2024

The goal is to improve https://maplibre.org/maplibre-style-spec/expressions/#in to better explain the two way in can be used.

  • ["in", ["get", "firstName"], "Hans Müller"] which would be true for firstName: "Hans" (at least that is how I understand the spec)
  • ["in", ["get", "firstName"], ["literal", ["Hans", "Dieter", "Rudolf"]]] which would be true for firstName: "Hans"

See also #555 (comment)

This change does not reflect this goal, but I think it's the best we can do which how the v8.json file is structured ATM. It does not look like it allows for multiple examples or for the examples to have variations.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.45%. Comparing base (c6bec09) to head (0fa6d6c).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #664   +/-   ##
=======================================
  Coverage   92.45%   92.45%           
=======================================
  Files         104      104           
  Lines        4624     4624           
  Branches     1303     1303           
=======================================
  Hits         4275     4275           
  Misses        349      349           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -2791,7 +2791,7 @@
"doc": "Determines whether an item exists in an array or a substring exists in a string.\n\n - [Measure distances](https://maplibre.org/maplibre-gl-js/docs/examples/measure/)",
"example": {
"syntax": {
"method": ["value", "value"],
"method": [["get", "value"], ["literal", "value"]],
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the syntax part of the example, so this won't be the right place to put it.
You can use links to places in the description, for example add a page in the gl js examples with all forms of "in".
You can link to tests in this repo too.
Or your could extend the code that parses the v8 into docs to have multiple examples for expressions.

@tordans
Copy link
Author

tordans commented May 15, 2024

Closed for now, follow up todos in #664 (comment)

@tordans tordans closed this May 15, 2024
@tordans tordans deleted the patch-2 branch May 15, 2024 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants