Template talk:Infobox road

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Highways (Rated Template-class, Mid-importance)
WikiProject icon This template is within the scope of WikiProject Highways, a collaborative effort to improve the coverage of highways on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 Template  This template does not require a rating on the project's quality scale.
 Mid  This template has been rated as Mid-importance on the project's importance scale.


Are there any plans to convert parts of this infobox to Lua, specifically the shield, route name, and translation? Now that we have fairly robust road data modules, I think these three items should be handled by the road data modules. Yes, I know that these will eventually be handled by Wikidata, but who knows when that will happen? We can use Lua now.

For those locations that don't yet have a road data module, we could utilize a tracking category to catch them, but I don't think there are very many. –Fredddie 16:01, 16 May 2015 (UTC)

There's no reason why we couldn't have the shield handled by Wikidata, similar to how the maps are now, though Happy might be waiting on other development last I heard (several months ago). --Rschen7754 16:04, 16 May 2015 (UTC)
Yes, my Summer of Code development. Face-wink.svg I have no problem with migrating the infobox shields, names, and translations over to the road data string modules. That can be done right now while we're waiting for the corresponding Lua code, since adding unused keys won't cause any errors. The only issue with using shields from Wikidata is an override for highways with non-free shields. I would also like to migrate the colors to the string modules at some point. As for the rest of the infobox, I'm still waiting for mw:Extension:Capiunto to be deployed. -happy5214 00:42, 17 May 2015 (UTC)
@Happy5214: do you have anything to report from the last four months? –Fredddie 01:37, 3 September 2015 (UTC)
No, nor might I have anything over the next four months. Feel free to migrate the infobox-specific data to the string modules, but module development has been stalled due to lack of progress on Capiunto and my own personal inactivity. -happy5214 07:13, 3 September 2015 (UTC)

Something that might be possible is to have Module:Infobox_road/length get the length from Wikidata, if available and not specified locally. I added length to [1] and we at least can use the same source for all US Interstate articles. Aude (talk) 09:09, 9 October 2015 (UTC)

@Aude: I have a few concerns about doing this now, although I'm sure it will be done eventually. Do you happen to know how quantities with units are handled in the Wikibase Lua library? Are unit conversions available from the library, or will client code (Infobox road/length) still be required to convert between miles and kilometers? -happy5214 11:10, 9 October 2015 (UTC)
@Happy5214: I don't think there is special handling (yet) in the Wikibase lua library for quanitites (e.g. conversion), but there is Module:Convert. What (else) do you have in mind that we need in the lua library? Suppose for now, I could help with adding this data to Wikidata and maybe experiment with lua in a sandbox module. Aude (talk) 12:29, 9 October 2015 (UTC)
Since I already have unit conversion code in my module, I guess all I would have to have is a way to determine the unit used for the statement. -happy5214 03:32, 10 October 2015 (UTC)
In the past, the only reason we never used {{Convert}} was because we wanted it to appear <length><reference> (<conversion>). So long as that's preserved, there will be no opposition from the "it's always been that way" lobby. –Fredddie 13:02, 10 October 2015 (UTC)
@Happy5214: now that I've thought about it for a little while, you really shouldn't need units. There are only a handful of countries (US, UK, Liberia, maybe one more?) that use miles for anything, so the country property should influence what unit is used. –Fredddie 14:11, 10 October 2015 (UTC)

RFC: Transitioning to Lua module[edit]

For the past week, I have been converting this template into a Lua module. The sandbox now does not transclude templates, except for certain fallbacks where (1) arguments to the live template need to be changed (discussed in issues below), and (2) data are yet to be defined in road data modules. There was a lot of data movement, and I think I am at a point to request for comments on where I decided to put things.

The goal is to use road data modules as much as possible. For USA, the following data are to be moved to road data modules (see Module:Road data/strings/USA and Module:Road data/strings/USA/NH for examples of an updated modules):

  • shieldmain: moved from Template:Infobox road/shieldmain/USA to each state's road data module. Defaults to shield if undefined.
    • shieldmainsize: size for shieldmain if it were to be displayed in {{jct}}. Defaults to shieldsize if undefined.
  • name: moved from Template:Infobox road/name/USA to each state's road data module.
  • translation: moved from Template:Infobox road/translation/... to each country's road data module. (I have yet to test this.)
  • law: moved from Template:Infobox road/law/USA to each state's road data module, if defined.
  • maint: moved from Template:Infobox road/maint/USA to each state's road data module.
  • browse: moved from Template:Infobox road/browselinks/USA to each state's road data module. Since browse links may be associated with route types or states, these links have to be moved to two places:
    • For links associated with route types, these move to the definition of the route type, e.g., USA.I.browse.
    • For links associated with states, these move to the common section for each state, e.g., NH[" common "].browse.
    • By default, the common browse is shown, but this might be undesirable for certain route types, e.g., county routes. To disable common browse, such route types may specify nocommonbrowse = true in the definition of the route type.
  • aux: moved from part of Template:Infobox road/meta/spur of to each stata's road data module. This is the full wiki markup describing auxiliary types, e.g., [[Business route]]. Lua loops can be used to fill these out automatically without explicitly writing them down.
    • For an irregular route that is auxiliary, but their route type is not auxiliary in general, e.g., New Hampshire Route 3A, |spec_auxtype= can be specified, where spec_auxtype is auxiliary code such as Alt and Bus. The definition of these types is at USA[" aux "].aux. This can be further overridden by providing full wiki markup in |spec_aux=. Defaults to Auxiliary route if none of these is unspecified.

For other countries, the data are to be moved to road data modules in a similar way.

Some data remain in the Infobox road namespace, because they govern how data are displayed and not themselves data:

These modules are structured so that they can be fetched with mw.loadData.


  • |subtype= should be deprecated, since |type= can now include auxiliiary types directly, as in US-Alt. Moreover, certain route types have multiple subtypes, e.g., US-Truck-Alt. This change will make route types consistent with {{jct}}. Transclusions using this parameter must be modified as part of the transition. To help with this, the sandbox concatenates subtype to type before invoking the road data module.
  • Translations depend on {{lang}}, which I don't know how to replace with modules yet.

Additional features

These are incorporated from past discussions and are independent of the transition.

  • Added support for nested infobox.
  • Automatically display country and state (without wikilinks for now).


Future work (we should discuss)

  • Rework the location section to allow custom labels (e.g., rural municipalities, divisions) instead of dedicated parameters. There are too many of them now, and I think these could get out of hand.
  • Rework the browse section to break things up from the current browse parameter. For example, multiple rows of previous and next routes can be specified with numbered suffixes, in the same way as multiple route sections.

Template:Infobox road/testcases and its subpages may be of your interest. Some shields therein might be incorrect because road data modules need an update. While the current sandbox is robust enough for the transition, template warnings should be inserted first so transclusions needing corrections can be readily identified. Chinissai (talk) 11:14, 6 May 2016 (UTC)

Template-protected edit request on 13 February 2017[edit]

Add a "regions" parameter for the bottom "Location" section of the infobox that would behave similar to the "counties", "cities', etc. but be used for administrative regions of Quebec, which act similar to counties in the U.S. C16SH (speak up) 19:52, 13 February 2017 (UTC)

Should be good to go. I enabled regions for all of Canada since that's how the backend was designed. –Fredddie 22:30, 13 February 2017 (UTC)

Additional sections?[edit]

When I created Mexican Federal Highway 180D, I thought four sections would be enough. Now I've found a fifth and cannot expand the infobox to include it. Mexican toll roads, by their nature, will have many segments as they are rarely long and continuous. Any idea as to what to do? Raymie (tc) 07:16, 15 February 2017 (UTC)

There is a highway in Arkansas that exists in 8 sections. When it was discussed before, the answer then was to use infobox road only for the overall summary of the highway, and then to use separate transclusions of {{infobox road}} for each segment in appropriate locations in the body of the article. At some point in the future, there may be support for additional infobox sections, but I think we're waiting on some recoding of other metatemplates in Lua, lest we complicate the existing code here further. Imzadi 1979  08:35, 15 February 2017 (UTC)
@Imzadi1979: Thank you; that's what I've done. Mexico articles are very difficult to write because numbers are not commonly used, there are often multiple segments, and the SCT plays fast and loose with designations. I'm looking at the big navbox and finding numbers that have been retired, like 126D which used to be in Michoacán but was changed to 14D. (Also the SCT's servers have been consistently unreliable, especially during evening hours.) Raymie (tc) 17:48, 15 February 2017 (UTC)