spencermountain / wtf_wikipedia

a pretty-committed wikipedia markup parser
https://observablehq.com/@spencermountain/wtf_wikipedia
MIT License
778 stars 129 forks source link

Section heading parsing only first template #489

Closed marcelogp closed 2 years ago

marcelogp commented 2 years ago

Some section heading may contain more than one template but only the first one is being parsed. For example in https://fr.wikipedia.org/wiki/Michael_Jackson

==== Désunion des Jacksons, ''{{langue|en|Northern Songs}}'' et ''{{langue|en|Captain Eo}}'' (1984-1986) ====

A solution would be using this implementation in heading.js:

const doInlineTemplates = function (wiki) {
  let list = getTemplates(wiki)
  list.forEach((item) => {
    let [txt] = parseTemplates(item)
    wiki = wiki.replace(item.body, txt)
  })
  return wiki
}
spencermountain commented 2 years ago

thank you Marcelo! great idea, wanna make a PR? I can add this in, otherwise. cheers

marcelogp commented 2 years ago

Hi Spencer. Can you do it, please? Thx