How does the “edit section” feature on Wikipedia work?

bailie28

New Member
How does Wikipedia implement the "edit this section" feature for its articles, wherein a user can edit just a section of an article, rather than the whole article? I've tried crawling through mediawiki's code by myself, but it's a bit dense for me to understand. Here's my guess (but only a guess):User click's on [edit] in an article. This links to the regular edit page, but with an additional parameter passed via GET in the URL specifying which section to edit. Without this extra parameter, Mediawiki would normally simply present the user with a form editing the entire page. But specifying a section to edit causes Mediawiki to extract ONLY that section and present it for editing.What stumps me is how does Mediawiki parse out individual sections? From what I understand, MW doesn't store the sections individually - it stores each ENTIRE VERSION of each version of the page as one big block of text (in addition to boatloads of metadata). Does MW simply look for H1, H2, H3, ... tags, and use those to split up the text into regions when it renders the page? And when a user saves a revised section, does it look at the current version, re-parse the text into sections, and just "inject" the new version into a copy of the current version, which it then saves as a NEW version?I assume my understanding of MediaWiki is grossly simplified, but I'm just trying to get a rough idea.Thanks!
 
Back
Top