Template talk:User

From OpenStreetMap Wiki
Jump to navigation Jump to search

OHM

The ohm= parameter seems to be hastily added and needs some improvements. I already fixed a bug where it made even some of the examples on this page not work correctly (empty osm= argument).

Some issues remain. Specifically:

{{User|lcmortensen|ohm=lcmortensen|osm=}} -> lcmortensen ( on osm, edits, contrib, heatmap, chngset com., on ohm) - contains broken links to OSM.org and other tools.

If osm= is empty, then the output should be similar to noedits=1 and only show a link to OHM:

{{User|lcmortensen|noedits=1}} ->

{{User|lcmortensen|wiki=|noedits=1}} ->

(But with ohm instead of osm)

--NeatNit (talk) 10:19, 14 May 2025 (UTC)

@NeatNit: Thanks for spotting these issues. I think these remaining issues might have already been present before I touched the template. I tried to avoid changing too much about the template when adding the OHM link in, but it proved quite fragile. I proposed a #Rewrite of the template that should fix the issues you've raised:
Please let me know if you spot any other issues that would prevent us from deploying the rewrite. Thank you!
 – Minh Nguyễn 💬 20:22, 29 September 2025 (UTC)

Rewrite

I've written this template at Template:User/sandbox with the following improvements:

  • Replaced the user avatar with File:Codex icon userAvatar.svg. The icon inverts based on the light/dark mode setting. This matches the Vector 2022 skin, which is currently the default. The current icon was based on the MonoBook style, which hasn't been the default skin on this wiki for some 15 years.
  • Deprecated the |m = and |f = parameters, which controlled whether to make the user avatar look masculine, feminine, or gender-neutral. The template no longer performs that customization automatically based on whether the user has set the MediaWiki interface to address them using male or female pronouns. That option is supposed to be personal, so exposing it publicly via the template is probably surprising and problematic from a privacy standpoint. The new icon is abstract enough to be perceived as gender-neutral to begin with, making this complex set of options unnecessary.
  • Simplified the wikitext and generated HTML code using {{Hlist}} and a template stylesheet. This hopefully fixes the corner cases in #OHM. It also has the side benefit of improving screen reader accessibility.
  • Link labels are localizable via custom MediaWiki messages.

Unlike previous rewrites, efficiency wasn't the main goal with this rewrite, but we should make sure that pages with an extreme number of transclusions of this template will still parse without hitting the template expansion limit.

 – Minh Nguyễn 💬 20:22, 29 September 2025 (UTC)

First, the icon similar to the interface icons (I use vector 2022) disturbed me a bit. But I can get used to it. I would use the "color-subtle" version which is less strong. Maybe the icon should be a little bit smaller? I don't mind of the gender things. In puncto performance I tried your template at the page Getting The Source and didn't encounter anything. --Chris2map (talk) 14:54, 7 November 2025 (UTC)
@Chris2map: Thanks, I applied your suggestions and it looks much better. – Minh Nguyễn 💬 22:25, 22 January 2026 (UTC)
@Minh Nguyen: I've just implemented your rewrite of the User template and replaced the former template code with the one from the sandbox. If anyone encounters an issue with it we'll handle it. --Chris2map (talk) 09:49, 22 February 2026 (UTC)

Line breaks

The rewrite is working great except for one flaw: if you embed it in the middle of a paragraph, it forces a line break before and after. For example, this section is now broken up into more lines than it should be. The culprit is {{Hlist}}, which is apparently a block-level template due to the use of semantically correct <ul>. This is a parser-level issue, not something that can be solved using CSS as far as I know. The only workaround is to wrap the surrounding paragraph in a different block-level element such as <div>. We could document this requirement for now, but I have no idea how many pages would be affected. – Minh Nguyễn 💬 10:15, 28 February 2026 (UTC)

I did some testing and it seems that this only occurs if the line of text belongs to no block element, that is, if there is absolutely nothing in front of or around it - no tag, no table. No matter what I put to it ( : / ; / * / # / <div> / <span> or a table) then the user template stays inline. So it is with "bare" text on a page. – I'd almost say that this is a reason to remove the {{hlist}} from the template. I've no idea how the template could add the block to the line of text. We'd have to tell the user of the template that he has to apply a tag or block element to the line manually. – Let's wait a few more days and see, and maybe find more cases. --Chris2map (talk) 12:37, 28 February 2026 (UTC)
The main reason for {{Hlist}} is to simplify the code that puts together the bulleted list. In theory, it produces good semantic HTML too, but this is counterproductive inside running text. Maybe we could modify Module:List to wrap the list in something that MediaWiki's HTML parser won't force out of the surrounding implicit <p> element. – Minh Nguyễn 💬 23:33, 8 March 2026 (UTC)