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

add sections 4,5,6 to Amount explainer #36

Merged
merged 3 commits into from
Dec 30, 2024
Merged

add sections 4,5,6 to Amount explainer #36

merged 3 commits into from
Dec 30, 2024

Conversation

tantek
Copy link
Member

@tantek tantek commented Dec 23, 2024

add flaws/limitations of existing features/proposals, how we can do better, and outline of a proposed solution. also subsections to more clearly delineate existing (working) features and prior (unimplemented) proposals

add flaws/limitations of existing features/proposals, how we can do better, and outline of a proposed solution.
also subsections to more clearly delineate existing (working) features and prior (unimplemented) proposals
@tantek tantek requested a review from zcorpan December 23, 2024 18:38
@tantek tantek requested a review from a team as a code owner December 23, 2024 18:38
@tantek tantek changed the title add sections 4,5,6 to explainer add sections 4,5,6 to Amount explainer Dec 23, 2024
amount.md Outdated

## Outline of proposed solution
Proposal: a new HTML `<amount>` element (similar to `<data>` and `<time>`), with:
* `value` attribute: optional numerical value, similar to the `<data>` element’s `value` attribute. Otherwise element contents are the value.
Copy link
Member

Choose a reason for hiding this comment

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

Can you articulate how the two interact? Is the text content a display of the value when there is a value? How would a value be derived from the content if it contains other decoration (for instance, how would <amount>35m</amount> work)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you articulate how the two interact?

The answer is similar to how it works for data element, as noted. This section is intended to be a brief understandable outline of a solution, not the entirety of how everything works, that's for section 7 and 9.

Is the text content a display of the value when there is a value?

Yes, which is how it works in the data element.

How would a value be derived from the content if it contains other decoration (for instance, how would <amount>35m</amount> work)?

Short answer is HTML has algorithms in various places for parsing out numeric values from text. Longer answer I'll write up in sections 7 and 9.

Copy link
Member

Choose a reason for hiding this comment

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

One final question: how do I choose Km/h rather than m/s? ("h" not being an SI unit)

Copy link
Member Author

@tantek tantek Dec 28, 2024

Choose a reason for hiding this comment

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

Interestingly enough, "km/h" is an SI unit, per https://en.wikipedia.org/wiki/Kilometres_per_hour at least:

The kilometre per hour (SI symbol: km/h; non-SI abbreviations: kph, km/hr).

Worth calling out compound SI units explicitly in summary outline. Will add a sentence accordingly to the unit attribute description.

amount.md Outdated
User agents may fully algorithmically transform such a unit to the user’s locale (user opt-in) or other display preferences.
* `currency` attribute: optional currency code (([ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)) to express a monetary amount. User agents could use an online exchange service to compute rough equivalents and note the source and time dependency (temporal context) of any such conversions.
* The presence of both `units` and `currency' attributes is an error. The user agent must ignore both attributes.
* If neither a `units` nor `currency` attribute are present, the amount is unitless and expresses a quantity.
Copy link
Member

Choose a reason for hiding this comment

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

If this is a quantity, is there a way to express what it is a quantity of? That is, <amount quantity="mince pie">5</amount> or would you just do <amount>5</amount> mince pies?

Copy link
Member Author

Choose a reason for hiding this comment

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

<amount>5</amount> mince pies?

This.

Copy link
Member

Choose a reason for hiding this comment

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

Show some examples please.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good suggestion even for the outline. Some of this feedback I am going to write-up into an expanded guide for our explainers. Adding examples.

@tantek tantek requested a review from martinthomson December 27, 2024 02:58
Copy link
Member

@martinthomson martinthomson left a comment

Choose a reason for hiding this comment

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

Obviously it's a bit hard to review this when it is as incomplete as it is, but this seems fine.

amount.md Outdated
Comment on lines 23 to 24
## Existing features and prior proposals
### Existing features
Copy link
Member

Choose a reason for hiding this comment

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

I was taught never to leave a section empty like this. Do you need the extra grouping?

Suggested change
## Existing features and prior proposals
### Existing features
## Existing features

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a brief sentence and explanation of why the subsections, to avoid the empty higher level section. Note that many (at least W3C) specs have such "wrapper" sections that do nothing but contain subsections so I'm not sure that's a well-accepted "never" rule. Perhaps a difference in style guidance across standards orgs.

amount.md Outdated

## Outline of proposed solution
Proposal: a new HTML `<amount>` element (similar to `<data>` and `<time>`), with:
* `value` attribute: optional numerical value, similar to the `<data>` element’s `value` attribute. Otherwise element contents are the value.
Copy link
Member

Choose a reason for hiding this comment

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

One final question: how do I choose Km/h rather than m/s? ("h" not being an SI unit)

amount.md Outdated
User agents may fully algorithmically transform such a unit to the user’s locale (user opt-in) or other display preferences.
* `currency` attribute: optional currency code (([ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)) to express a monetary amount. User agents could use an online exchange service to compute rough equivalents and note the source and time dependency (temporal context) of any such conversions.
* The presence of both `units` and `currency' attributes is an error. The user agent must ignore both attributes.
* If neither a `units` nor `currency` attribute are present, the amount is unitless and expresses a quantity.
Copy link
Member

Choose a reason for hiding this comment

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

Show some examples please.

@tantek tantek merged commit 8731d52 into main Dec 30, 2024
@tantek tantek deleted the tantek-patch-1 branch December 30, 2024 22:53
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.

2 participants