-
-
Notifications
You must be signed in to change notification settings - Fork 36
Allow options on closing markup placeholders #582
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not find the use case for this compelling.
Having written and maintaining a potential MF2-XLIFF2 bidirectional conversion, I find the <ec startRef>
to be plenty sufficient to not introduce a need for MF2 to include a feature like this, especially as the baskets of options used by MF2 will in any case need to be maintained separately from the <sc>
/<ec>
pair, or a similar structure in other message formatting languages.
I believe that if we later do find from deeper work in such conversion tooling that we need something like this in MF2, then that conversation can and should be informed by example messages through which to consider this.
@eemeli I think a question might be: do we have sufficient reason to prohibit it? Instead we might allow implementations to prohibit it or specific markup regimes to prohibit it (where "it" == options on close). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tweaks.
Some use cases for closing markup placeholder In general anything that allows "incorrect nesting" (which might not be incorrect in the given platform), and use the same tag name. Similar to A real example would be certain Android spans. Similar to this in HTML: In HTML I have no way to say that the first Sure, one can say: then refactor the Android code to do the same. This also happens in the iOS / macOS CFAttributedString Another use case would be ANSI escapes.
Not only there is no requirement for correct nesting, but some "closing" escapes (like the reset one, So one might want to encode some info about this, some grouping tag, that informs how a remove or a clone might work. |
With a great sample of two :-), there are also people questioning the HTML decision: There is the user asking the questions, and the last one, saying "from this HTML end-user's view it seems absolutely absurd that a closing DIV can't be easily identified" (that is how I counted 2) And most people there said no, and offer workarounds. I didn't see one saying "what you are asking is absurd" Also |
A message using such StyleSpans could easily be represented in MF2 as:
i.e. quite similarly to how it's represented in your example HTML.
I would represent this in MF2 as (hard-wrapped for legibility):
I agree the that the above markup doesn't nest like HTML or XML, but I don't see a need here for closing-markup options? The reset in particular resets everything. Alternatively, it's also possible to express this with HTML-like nesting, provided that we assume the message's formatting to start in a reset state:
|
Think HTML |
But this hardcodes additional information into the tag name. Instead, consider:
in which we only encode the identifier of the spannable, and then let the callsite add concrete formatting attributes (possibly more than one) to each of them, by id. |
Yes, matching the small set of StyleSpan styles:
Is there any Android span that might make sense to have overlapping ranges, and which does not have such a hardcoded short list of variants? That might make this a more convincing example.
While I continue to not be convinced here, I would like to note that as far as I can tell, the only argument being made for options on markup-close is an equivalent of the XLIFF 2 Are there any other potential use cases for options on markup-close that should be accounted for? |
Of course. See here for complete list (click "and 10 others" for a summary table): There are many in that list with "an unlimited number of options", but And one can implement its own spans: https://developer.android.com/develop/ui/views/text-and-emoji/spans#custom-spans iOS and macos have similar attributes, including the ability to create custom ones.
Potatoes / potato ;-) One can register markup in the html namespace that behave exactly like html. And say that the closing tag takes no parameters.
And also, note the ANSI escapes. I think we already have some decent use cases. Our lack of imagination should not prevent people from doing what they need, now or 5 years from now. I think that in general our philosophical position was to not take away freedoms unless we have reasonable arguments that allowing something is bad i18n. |
As a follow-up to #541 (review), we'd like to allow options on "close" markup placeholders.
The main use-case is tooling and XLIFF interchange. See also #450 which proposes a different mechanism for this (but hasn't yet been accepted).