respectively. I understand that diverting as little as possible from upstream is very desirable, but on the other hand, much of the discussion on Discourse is related to tagging, and it is very cumbersome and very error-prone to try to manually create links like that (even when using copy/paste generously). There are also almost impossible to re-read by the author and find right place in editing window while editing the message.
And Iâve noticed that by just doing low-effort artwork_type=sculpture is not only less readable, but leads to many misunderstandings and needless explaining, as not many users (read: almost nobody) will bother to open wiki.openstreetmap.org and search for those tags, fighting with sub-ideal wiki search functionality.
But when theyâre made as links, and theyâre just one click away, theyâll click them a lot more often and thus get information easily.
So adding such support would help enormously both people writing the messages mentioning wiki tags, and people reading (and replying) to those messages.
Iâve no idea how hard this would be to implement, but itâd be great! It could even support all (or a specific list of) wiki templates, and could probably render them via an API call to action=parse, reducing the amount of work done on the Discourse side and ensuring the formatting here and on the wiki stays the same.
Unfortunately, Discourse wonât display a âoneboxâ if you put the URL of a wiki or taginfo page about the tag on its own line, because neither site specifies the required meta tags. For the wiki, this would entail enabling the PageImages extension that comes with MediaWiki.
Iâve noticed that too @Minh_Nguyen, but donât see how it is related to this thread? (which is about adding support for inline rendering of {{Tag|artwork_type|sculpture}} as artwork_type=sculpture)
(perhaps you intended to create separate thread for that request?)
Iâve done some digging, and it does not look very complicated (if one already has test instance of Discourse running, of course, which seems like vast majority of the work).
The closest and simplest I could find is this abbreviation plugin (~100 lines of code and CSS combined) which seems to find certain acronyms from (setting it implements), and adds HTML <abbr> tags around them for explanation.
Which seems even more complex than we would need here (we donât even need that settings preference)
This main part of code seems to be just several lines of code culminating in simple RegEx:
much of the rest of the code seems like common-to-reuse boilerplate for this case.
And the RegEx itself should be simple too, e.g. this for JS:
text = text.replace(new RegExp('{{key\\|([^}]+)}}','gi'), '<A HREF="https://wiki.openstreetmap.org/wiki/Key:$1">$1</A>');
text = text.replace(new RegExp('{{tag\\|([^|]+)\\|([^}]+)}}','gi'), '<A HREF="https://wiki.openstreetmap.org/wiki/Key:$1">$1</A>=<A HREF="https://wiki.openstreetmap.org/wiki/Tag:$1=$2">$2</A>');
Actually it wasnât quite a request â I started out suggesting a onebox as a temporary workaround for the lack of this formatting, but I had to edit the post because the oneboxen donât even appear. Sorry for the confusion. I do think the PageImages extension (which enables Discourseâs onebox feature by coincidence) would be very nice to have, but that discussion belongs on the wiki for now.
@Firefishy As noted above, I did some research and it seems relatively easy to do - there is a plugin which does very similar thing. If one were to invest time to write such plugin, would it be included?