• I need to help a user converting his old infoboxes to the new ones. Problem is, the old infoboxes use unnamed parameters and generally a bad syntax. Let's use this page as an example, I'd like to make a regex for AWB (or if there are better tools, tell me, I know you can use th advance find and replace settings to probably do something about it) to convert the infobox template from

    {{Personaggio|[[File:Arzakon.jpg|265px]]|Arzakon|[[Piani del Multiverso|Piano Sconosciuto]]|Data Sconosciuta|Sconosciuta [[Planeswalker]]|-|Sconosciuto}}

    to something like

    | par1 = [[File:Arzakon.jpg|265px]]
    | par2 = Arzakon
    | par3 = [[Piani del Multiverso|Piano Sconosciuto]]
    | par4 = Data Sconosciuta
    | par5 = Sconosciuta [[Planeswalker]]
    | par6 = -
    | par7 = Sconosciuto
      Loading editor
    • The way I would do it is implant the unnamed parameters into the new PI parameters which should accept old and new input options

        <image source="image"><default>{{{image|{{{1|}}}}}}</default></image>
        <data source="name"><label>Nome</label><default>{{{name|{{{2|}}}}}}</default></data>
        <data source="home"><label>Originario di</label><default>{{{home|{{{3|}}}}}}</default></data>
        <data source="lifetime"><label>Lifetime</label><default>{{{lifetime|{{{4|}}}}}}</default></data>
        <data source="race"><label>Razza</label><default>{{{race|{{{5|}}}}}}</default></data>
        <data source="title"><label>Titolo</label><default>{{{title|{{{6|}}}}}}</default></data>
        <data source="state"><label>Stato</label><default>{{{state|{{{7|}}}}}}</default></data>

      existing infobox
      |[[Piani del Multiverso
      |Piano Sconosciuto]]
      |Data Sconosciuta
      |Sconosciuta [[Planeswalker]]

      new infoboxes
       | image = Gloria.jpg
       | name  = Arzakon
       | home  = [[Piani del Multiverso|Piano Sconosciuto]]
       | lifetime = Data Sconosciuta
       | race  = Sconosciuta [[Planeswalker]]
       | title = -
       | state = Sconosciuto
        Loading editor
    • Oh, you are right, didn't think about doing that. That is certainly a good fix, I'll do it meanwhile, but I would still want to fix the template calls with a bot...

        Loading editor
    • Is the naming the same on all templates?

      There's probably a simpler way to combine all this, but you can use regex to detect the first instance. My regex isn't very good (it's my social isolation project), so please double check:

      • Look for ^(.*?)(\|\[\[File\:) (the first instance of "|[[File:"), and Replace it with "$1| Image =". Find and replace "\|([0-9]+)px\]\]" with " " (zilch)
      • After that, you'll probably have to run it for every template field. And somehow build in a contingency for pipelinks. "\[\[(a-z0-9]+)\|(a-z0-9]+)\]\]" or something. I'm no expert.

      And don't run the bot with auto save on, verify every change manually and skip if necessary.

        Loading editor
    • this regexp will not work well. because of many reasons.

      whole the job is too hard to do automatically. if even regexps can do this, the regexp will be very complex and, in general, doesn't worth the time that would be spent. i strongly suggest to stick to this. you can change all calls by your hands. you might think that it will take more time, but i pretty sure that it will be faster, than development of proper regexp. also, there is no rush: you can maintain double set of params infinetely.

        Loading editor
    • Fngplg wrote: this regexp will not work well. because of many reasons.

      Trust me, I know.

        Loading editor
    • I already implemented TableWiz's proposal, but I still wish to fix the template calls on pages to help the admin there.

        Loading editor
    • use your hands.

      in order to track unconverted calls, you can use tracking (hidden) category: {{#if:{{{1|}}}|[[category:deprecated]]}}

        Loading editor
    • FindAndReplace could alleviate some of the manual work. Or you could add a button to the toolbar with JS that gives you the empty template, so you can just copy paste the values to the right field. Seems easier than adding the same value names to the correct input line.

      Manual is going to be a grind, since it's used on 2500+ pages.

        Loading editor
    • You have to understand, they have only a couple active users. If they had a big userbase like English wikis, than that wouldn't be too bad to do. That's why I'm asking if anyone can help, I know that is possible at least. Of course if I won't figure it out, they will have to do it by hands... but at least I can try.

        Loading editor
    • i repeat myself: there is no rush: you can maintain double set of params infinetely.

      just update template docs (if not yet), and people will use named params. meanwhile, old calls will be replaced. one-by-one. you (nor anyone else) don't have to do it right now! omg!! it gonna blow!!!

        Loading editor
    • I apologize if I made it sounded like it was urgent, as you said it's not and I already did what was suggested by TableWiz. I don't need help doing that, but I need help to figure out a regex or something similar in order to update the template calls with a bot. That is, after all, my original request and the reason I opened this thread. If no one can help, so be it, but at least I can try and ask.

        Loading editor
    • to avoid possible errors (and with thousands of invocations, you will have them), you need custom processing. awb can use custom modules, but you have to know vb or c#. this is like the only real option to do this automatically, and to not break anything.

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message
Community content is available under CC-BY-SA unless otherwise noted.