Wikipedia oneboxing with url encoded section hash

I haven’t categorized the topic as bug because it might be by design, not sure…
so this works
https://fr.wikipedia.org/wiki/Th%C3%A9ologie#Platon

this doesn’t
https://fr.wikipedia.org/wiki/Th%C3%A9ologie#La_th%C3%A9ologie_selon_Aristote

Weirdly the span ids are La_th.C3.A9ologie_selon_Aristote and La_théologie_selon_Aristote :thinking: so I think there is something here: discourse/lib/onebox/engine/wikipedia_onebox.rb at 2f28ba318c3f650b1a0a76530021bc21bc8ab6f6 · discourse/discourse · GitHub

I sure hope so! :grin:

1 Like

Both of your oneboxes work just fine for me in Android :thinking:

The links work yes, but for the second one the excerpt should be:

La poésie et les origines de la pensée… etc

ps. you had me :crazy_face: for a second here!

Oh you want the onebox summary to reflect the sub-section? That is controlled by

That is not matching

<h3>
  <span id="La_th.C3.A9ologie_selon_Aristote"></span>
  <span id="La_théologie_selon_Aristote">La théologie selon Aristote</span>
</h3>

The code is over 7 years old, so it’s very possible that the Wikipedia markup changed in the meanwhile. It’s a pr-welcome if someone wants to work on this.

2 Likes

I’ve sent a possible fix at Fix/wikipedia oneboxing with url encoded hash by jbalsas · Pull Request #14015 · discourse/discourse · GitHub</titl.

I think unescaping the m_url_hash_name should be enough to cover all cases.

Hope this is the right process to contribute! :crossed_fingers:

3 Likes