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

Enhance #set: parser function with display option #5624

Open
krabina opened this issue Apr 12, 2024 · 4 comments
Open

Enhance #set: parser function with display option #5624

krabina opened this issue Apr 12, 2024 · 4 comments
Labels
enhancement Alters an existing functionality or behaviour

Comments

@krabina
Copy link
Contributor

krabina commented Apr 12, 2024

Since the #set: parser function is not a 100% replacement for the inline annotation [[Foo::Bar]], we should need to move forward in this direction. Therefore I propose to add a display functionality to the parser function.

Background

In this issue, I am not referring to the problem of SMW installations that generally use the inline annotation to annotate content in wikitext using the wikitext editor. For this, see #4727

In the use case I am addressing, semantic values are set in a template, which is the general use case for many SMW installations. It is generally not a problem to avoid inline annoations in templates:
Instead of putting
Your Property: [[Foo::Bar]] in your template (maybe for a fact box of a wiki article), it is easy to do something like
Your Property: {{{Bar|}}}{{#set:Foo={{{Bar|}}} }}
This approach also has the advantage, that in your template you can control the output of the value {{{Bar|}}} anyway you like and set the property with the silent {{#set:Foo={{{Bar|}}} }} annotation.

Problem

The problem, however, is that in the set parser function is not a complete replacement for the inline annotation. These are some cases (there are certainly more):

  • Datatype External Identifier will render a link that points to the external formatter URI. You cannot achieve this with [[{{{Bar|}}}]] in the template. This will render an internal link instead of the link to the external URI.
  • Datatype Keyword can be used with a keyword link formatter rule, which also works only with inline annotations.
  • The property link feature only works with inline annotations: [[Your Property::@@@]]
  • It is cumbersome to annotate Property Pages with the silent annotation, since you usually want have something displayed there. My workaround is this, e. g. for a page Property:Link
* [[Has type::@@@]]: {{#show:{{FULLPAGENAME}}|?Has type}}
* [[Has preferred property label::@@@]]]: {{#show:{{FULLPAGENAME}}|?Has preferred property label}}
* [[Has property description::@@@]]: {{#show:{{FULLPAGENAME}}|?Has property description}}

{{#set:
|Has type=Url
|Has preferred property label=Link@de
|Has property description=Externer Link@de
|Has property description=External Link@en
}}

Solution

It should not be very hard to add a display option to the #set parser function. Basically it is something like combing #set and #show.
Suggested syntax:

{{#set:
|Has type=Url|+display=link
}}

Other options:

  • none (default)
  • text

This approach would also enable backwards-compatibility, because if the option is omitted it can default to "+display=no" which does not change the current behavior.

I am interested to hear what others think about this.

@krabina krabina added the enhancement Alters an existing functionality or behaviour label Apr 12, 2024
@krabina
Copy link
Contributor Author

krabina commented Apr 19, 2024

@cscott - I just rewatched your presentation at MWCon. This issue mentions some places where the #set parser function is not yet a replacement for the inline annotations

@YOUR1
Copy link
Contributor

YOUR1 commented May 2, 2024

The first question coming up to mind is how does this work with a LUA combo?

@gesinn-it-gea
Copy link
Member

Why not using https://www.semantic-mediawiki.org/wiki/Help:Setting_values/Working_with_the_template_parameter

{{#set:Comment|Alexander|template=Text}}

and a template with

{{{value}}}

@krabina
Copy link
Contributor Author

krabina commented May 2, 2024

It might be a disadvantage for performance if you always have to use template inclusion in every property annotation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Alters an existing functionality or behaviour
Projects
None yet
Development

No branches or pull requests

3 participants