Support Wikipedia anchors in onebox

AI-generated summary

The discussion revolves around supporting Wikipedia anchors in onebox. sam initiated the conversation, stating that onebox should link to the correct section of a Wikipedia page, rather than the top section. Lid experimented with utilizing the Wikipedia API to retrieve section content, but encountered issues such as retrieving the entire section instead of just the first paragraph, and additional processing requirements. Lid then pushed a commit to GitHub with the changes. sam expressed enthusiasm for Lid getting their dev environment working, despite some technical difficulties. Ultimately, Lid successfully implemented the support for Wikipedia anchors in onebox, demonstrating the functionality with links to a Wikipedia page with and without section anchors.

It would be nice if HTTP cookie - Wikipedia oneboxed the correct section, instead of the top section.

6 curtidas

for fun and giggles
jsFiddle Experiment | Getting wikipedia section content with ajax

utilizing the Wikipedia API ( API:Action API - MediaWiki ).

To retrieve the section content with this approach I had to make 2 requests

  1. get a list of all the sections of an article to identify its numeric id (needed for the 2nd request)
  2. request of a particular section content based on the id.

The bad
The solution return the entire section and not just the first paragraphs as onebox appears to do.
I was thinking that using the wiki api might make the process more efficient at least, but it is not
additional processing is required to fix relative a tags

  • it also return some nonsense [edit] text

my conclusion is that is probably better to just go with the current approach and use Nokogiri for section parsing :smile:

1 curtida

https://github.com/lidlanca/onebox/commit/3ccb2d7fccbb1eab4108307fc4c20baa7c46a554

5 curtidas

WAT awesome you got your dev environment going!

Technically my Dev environment is working but it is limping due to virtualbox issues.
Hopefully the next virtualbox release will magically fix the bug I experience.

But luckily the onebox can be worked as a standalone, wasn’t too much trouble to get it working on windows.

1 curtida

This is working now :smile:

http://en.wikipedia.org/wiki/HTTP_cookie
http://en.wikipedia.org/wiki/HTTP_cookie#Secure_cookie
6 curtidas