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

Handling Template:Br_list in infoboxes? #516

Closed
tmtmtmtm opened this issue Feb 1, 2023 · 5 comments
Closed

Handling Template:Br_list in infoboxes? #516

tmtmtmtm opened this issue Feb 1, 2023 · 5 comments

Comments

@tmtmtmtm
Copy link

tmtmtmtm commented Feb 1, 2023

When an infobox switches from an explicit <br> tag to use {{Br list}} instead (e.g. at https://en.wikipedia.org/w/index.php?title=Romina_P%C3%A9rez&diff=1136738344&oldid=1131803626), that entry entirely vanishes from the infoboxes section of the wtf_wikipedia output (ie in this case wtf_wikipedia https://en.wikipedia.org/wiki/Romina_P%C3%A9rez | jq -r . | fgrep office2 has no results)

It does appear in the templates section:

        {
          "list": [
            "Member of the Chamber of Deputies",
            "from Cochabamba"
          ],
          "template": "br list"
        },

but I can't see a way to tie those back together. Am I overlooking something? Or might it be possible to handle this template in a way the retains the value?

@spencermountain
Copy link
Owner

Yep - sure, I can look at this this week.
Thanks

@tmtmtmtm
Copy link
Author

tmtmtmtm commented Feb 4, 2023

That's great, thanks!

spencermountain added a commit that referenced this issue Feb 8, 2023
@spencermountain
Copy link
Owner

spencermountain commented Feb 8, 2023

got a fix for this for the next release, for now you can do this

let str = `{{Infobox officeholder
  | name               = Romina Pérez
  | office2            = {{Br list|Member of the [[Chamber of Deputies (Bolivia)|Chamber of Deputies]]|from [[Cochabamba Department|Cochabamba]]}}
}}`

wtf.extend((models, templates) => {
  templates['br list'] = templates['br separated entries']
})

//should work now:
let doc = wtf(str)
console.log(doc.infobox().json())
/*
{
  name: { text: 'Romina Pérez' },
  office2: { text: 'Member of the Chamber of Deputies\n\nfrom Cochabamba' }
}
*/

cheers

@tmtmtmtm
Copy link
Author

tmtmtmtm commented Feb 8, 2023

Oh, very nice. That seems to do the trick nicely for now. Thanks!

@spencermountain
Copy link
Owner

fixed in v10.1.3
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants