-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Markup: can we use argument-less functions to represent standalone display elements? #240
Comments
Comments migrated from the slides{b}bold{/b} Slides comment, Richard Gibson (@gibson042), 7:52 AM Apr 21 This overloading of the same syntax for singleton expressions and paired markup seems awkward... I guess it's like expressions are a special degenerate form of markup that cannot have nested content? Slides comment, Eemeli Aro (@eemeli), 8:07 AM Apr 21 That's one way of looking at it, sure. Our thinking is more driven by considering within message contents for the |
TL;DR: Argument-less functions and standalone markup elements could be synonymous if the function registry allows for pass-through "formatting" of type+name+options entries as parts. Having pondered this question recently, I think it may be useful to map out the space in which we need to answer this question. When we parse the syntax of either argument-less function expressions or standalone markup elements into a data model, prior to resolving any registered functions or considering the values of formatting parameters, we may consider the result to be a structure with:
During message resolution and formatting, we need to perform three distinct steps that are relevant:
Given all that, to me the important next question to ask is:
If these should be considered relatively common, then we ought to handle argument-less functions the same way the we handle function expressions that do have an argument. On the other hand, if this is a sufficiently rare use case, I think we could optimise the syntax and its processing towards there being less difference between formatting functions and markup. To start, let's consider a slightly different syntax for markup elements, where rather than Now, what could something like Overall, I think this view has quite a bit of similarity with ideas that @mihnita has been presenting (of there being little difference between formatting functions and markup elements) and with some thoughts that I recall @zbraniecki making, of asking whether a registered function can return an element. To sum up, I would solve this by allowing for four different sorts of placeholders:
I would not mandate in the spec any particular meaning to any of these, leaving that to the function registry. It would need to answer the following questions:
|
I don't like giving certain markup special status in the syntax, and I get lost a bit in @eemeli's intro above, but his conclusion makes sense to me :-) I think it's fine to have a function without a value (argument or literal). I know that various kinds of markup, or style spans, are common, and have XLIFF support for open/close annotations. Eemeli's plus/minus prefixes seem ok for that, including the restrictions like "not valid as selector", and "no options" for the closing one. I would permit arguments and literals for at least an "opening" placeholder. It could allow something like |
PS: It might be more obvious if a function name always has the same prefix, such as |
I would prefer a namespaced function name instead:
This approach has the same expressive power, but allows for clearer nesting. For example:
It would also be more straightforward for the registry to define different valid options baskets for Given the above preference, I remain unconvinced that there's a real-world use case for any |
I like the namespaced function
…On Tue, May 31, 2022, 02:48 Eemeli Aro ***@***.***> wrote:
I would permit arguments and literals for at least an "opening"
placeholder. It could allow something like {(a) +html href=(some
url)}link text{-html} -- using parentheses as literal delimiters as an
example. If we were to use the same thing for making the link bold, then we
would get a nested pair of placeholders with the html function. This may
not be the best way to represent this, but syntactically it should be
allowed, and the registry should say which function does what.
I would prefer a namespaced function name instead:
{+html.a href=(some url)}link text{-html.a}
This approach has the same expressive power, but allows for clearer
nesting. For example:
{+html.a href=(some url)}link {+html.b}bold{-html.b} text{-html.a}
It would also be more straightforward for the registry to define different
valid options baskets for +html.a and +html.b, compared to a single +html
function having its valid options depend on the value of its argument.
Given the above preference, I remain unconvinced that there's a real-world
use case for any +foo function to be able to take a positional argument.
—
Reply to this email directly, view it on GitHub
<#240 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJLEMAEKZ2YLSYBVGIVVOLVMXN55ANCNFSM5VWCS36A>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Good points about different sets of options for different markup functions, rather than using a value literal to distinguish. In the discussion yesterday, several people liked allowing dots in function names for the purpose of namespacing custom functions (functions not defined in the CLDR MF2 registry) in Java package style, such as For various HTML elements, we could use an underscore to visually segment a flat namespace, such as If we want to standardize them, we should probably try to define a "link" function rather than tying it to HTML. Links are useful in lots of environments. Same for some common styles. For things that are truly specific to HTML, we can use an
I would allow it syntactically, and note in the function registry whether a particular function takes an argument or not. |
I think we still need to determine if there is any conceptual difference between Because the engine should be aware of it, should be able to split html.a vs tts.a If we treat it as a simple separator that is not part of the "engine" concern (like using "html_...") This is what the mf2 engine (and icu implementation) would do format a literal value: Find the function registered under the "datetime" name, and invoke it with the sting value "20220427T1442" and a map of options that contains This is what we need to do for markup (ignore the syntax for a second): 100% similar: find the "function" that handles "html" and invoke it with the string "a" and a map of options that contains If we say In other words: who does the "dispatch" between the tts / html / mihai namespaces? |
TL;DR: Argument-less functions and standalone markup elements could be synonymous if the function registry allows for pass-through "formatting" of type+name+options entries as parts.
After reading the whole thread several times, I still don't quite get it.
Standalone and argument-less seem orthogonal.For example <img src="..." alt="..."> is standalone, is "markup element", but has arguments.
To sum up, I would solve this by allowing for four different sorts of placeholders:> {$arg :foo opt=42}
{:foo opt=42}> {+foo opt=42} (not valid as selector)> {-foo} (no options, not valid as selector)
We need more than that.What about {+bar :foo opt=42} and {-bar :foo} ?The :foo acts like a namespace. It tells us if these elements should be processed by a html engine, a markdown engine, a tts engine, etc.I also don't see a standalone tag here.
I would prefer a namespaced function name instead:> {+html.a href=(some url)}link text{-html.a}
Isn't this just syntactic sugar to :html as a function?The tag is "a", the function is :html.So why not {"+a" :html href=(some url)} ?Why invent another syntax?
M.
On Tuesday, May 31, 2022, 06:36:05 AM PDT, Mark Davis ***@***.***> wrote:
I like the namespaced function
On Tue, May 31, 2022, 02:48 Eemeli Aro ***@***.***> wrote:
I would permit arguments and literals for at least an "opening"
placeholder. It could allow something like {(a) +html href=(some
url)}link text{-html} -- using parentheses as literal delimiters as an
example. If we were to use the same thing for making the link bold, then we
would get a nested pair of placeholders with the html function. This may
not be the best way to represent this, but syntactically it should be
allowed, and the registry should say which function does what.
I would prefer a namespaced function name instead:
{+html.a href=(some url)}link text{-html.a}
This approach has the same expressive power, but allows for clearer
nesting. For example:
{+html.a href=(some url)}link {+html.b}bold{-html.b} text{-html.a}
It would also be more straightforward for the registry to define different
valid options baskets for +html.a and +html.b, compared to a single +html
function having its valid options depend on the value of its argument.
Given the above preference, I remain unconvinced that there's a real-world
use case for any +foo function to be able to take a positional argument.
—
Reply to this email directly, view it on GitHub
<#240 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJLEMAEKZ2YLSYBVGIVVOLVMXN55ANCNFSM5VWCS36A>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Re-styled and re-indented for clarity; the email style processing seems a bit broken here. I'll reply below regarding standalone elements; for the other matters this issue is getting rather off-topic. We should probably continue under #238?
To clarify, I would consider the MF2 equivalent of element attributes to be named options, rather than positional arguments. With that model, the example you give is indeed "argument-less" as
A standalone tag representation would here be provided by
|
This issue should be addressed by the design document on spannables. Can we close this in favor of considering our design choices there? |
@aphillips I've linked #541 to close this when it's merged. |
No description provided.
The text was updated successfully, but these errors were encountered: