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
- get a list of all the sections of an article to identify its numeric id (needed for the 2nd request)
- 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 ![]()