Proposal for type-and-role data
Shaun McCance
<shaunm at gnome.org>
Sun Sep 1 12:02:18 EDT 2019
- Sort by: [ thread ] [ subject ] [ author ] [ date ]
Hi folks, I want to address three open issues/MEPs that should really just be addressed all at once for 1.2: * Allow roles on sort titles: https://github.com/projectmallard/projectmallard.org/issues/1 * Allow multiple desc elements: https://github.com/projectmallard/projectmallard.org/issues/16 * Add a thumb informational element: https://github.com/projectmallard/projectmallard.org/issues/54 These all concern elements that (would) live inside <info> and have type and role attributes so you can provide multiple for different purposes. I don't want to make this email long explaining the current types of titles. Here's some reading for you: * http://projectmallard.org/1.1/mal_links * http://projectmallard.org/1.1/mal_info_title I gave a lot of thought to how I can generalize the type-and-role lookup of sort titles to the three cases linked above. One of the problems was that I didn't want to require type="link" on desc just to use roles, because it's the only thing desc is currently practically used for. Too much typing. But I wanted to avoid having different elements behave differently. Too much cognitive overhead. Here's what I came up with: To get the title/desc/thumb for a type $type and a list of roles $roles: 1) For each $role in $roles, if there exists an info title/desc/thumb with the type attribute set to $type and the role attribute set to $role, use that title/desc/thumb and skip the rest. 2) If there exists a title/desc/thumb with the type attribute set to $type and without a role attribute, use that. 3) For each $role in $roles, if there exists an info title/desc/thumb with no type attribute and with the role attribute set to $role, use that title/desc/thumb and skip the rest. 4) If there exists a title/desc/thumb without a type attribute and without a role attribute, use that. 5) Finally, if you're looking for a title, go ahead and use the primary display title (outside the info element) if nothing else matches. This does change the current link title lookup, but only by adding titles without type attributes as extra fallbacks. I don't see any real compatibility issues. I think there's an argument for swapping steps 2 and 3. Basically, is type more important or role? But I think I like it this way. With this, you could provide the same link and sort title for a role with just a single element. So I fully expect most people's reaction is going to be "ok whatever just pick something", so thanks if you've actually read this far. But if you have the mental bandwidth, I'd very much appreciate another person looking at the specs and issues and double checking that what I've proposed makes sense. Thanks, Shaun