Extension:BookManager/Improve support for book structures

Hi! I'm Molly White, or GorillaWarfare on the various projects. I am applying for Summer of Code 2013 and Outreach Program for Women. I would love to hear any feedback you have for me, and I can be easily contacted on IRC, by email, or by talk page message (see below for details).

Identity
Name: Molly White Email: gorillawarfarewikipedia@undefinedgmail.com or molly.white5@undefinedgmail.com Project title: Improve support for book structures

Contact/working info
Timezone: EDT (UTC -4:00) Typical working hours: Very flexible. I can adjust my work hours to anytime between 13:00–07:00 UTC (09:00–03:00 Eastern), but I anticipate working from 15:00–23:00 UTC (11:00–19:00 Eastern). IRC or IM networks/handle(s): GorillaWarfare (Freenode) Time constraints: I just want to be clear up front that I do have a few time constraints to work around. I will be working a full-time job up until either June 21 or June 28 (I still need to figure this out with my employer). I'm also in college, and classes start for me on September 4. Although I realize the overlap is somewhat significant, I'm fully prepared to dedicate most of my evenings/weekends to working on the project while I'm working or in classes.

Project summary
This project aims to improve the BookManager extension so that it can be used to collect a book (from Wikisource, Wikibooks, or similar) into a single unit, instead of a scattered and loosely-organized set of pages. Once this is achieved, the book can be treated as a single unit, which eases limitations regarding navigating, exporting/printing, watchlisting, protecting, etc.

There are a number of wikis (for example, Wikisource and Wikibooks) that consist of content that is structured as a book. MediaWiki does not currently have much in the way of support for this structure, and so these wikis are forced to try to adapt the article structure to suit their needs. Wikisource has adapted by using an Index namespace for individual pages, then collecting each chapter (or an entire work, if the work is short) in the main namespace. If the work spans several subpages (in the case of chapters), the pages are linked together using header templates, and an index page of sorts is typically used for a landing page. Wikibooks uses a similar structure, using subpages of an article for each chapter. These adaptations work, but are severely limited and unstandardized.

I will modify the BookManager extension: an existing attempt to address this issue. The extension currently needs to be stabilized, but it is a good starting point for this project. A user will use a form (see right for a mockup) to organize the book into parts. If the book has an Index page for each page of the book (as on Wikisource works that have scans), these pages will be organized into chapters by specifying page ranges. These chapters will be ordered and organized into the book. Once the book is organized as such, the extension can optionally create a table of contents, navigation bar, and/or a print version.

To organize the book, the extension will be modified to use a JSON structure, which will neatly collect all the necessary metadata and organizational information. I have created an example at User:GorillaWarfare/Proposal/JSON. This data will be editable via a form (see right for a mock-up); users will not need to manipulate the raw JSON. Each book will have a single main page that can be used to interact with the book as a whole. These interactions include improved support for exportation and printing, as well as technical changes such as deleting or protecting. There are quite a few enhancements that depend on this organizational structure (see Bugzilla), and I hope to tackle some of these as a part of the project.

Mentors
User:Raylton P. Sousa (maintainer of BookManager) and User:Mwalker (WMF) have offered to mentor me. User:Tpt has offered to co-mentor, if a Proofread Page GSoC project does not materialize. As of now, I am planning to at least work with Raylton on this project.

Required deliverables

 * Stabilize Extension:BookManager
 * Design a final JSON schema to represent each book (see the beginnings of this at User:GorillaWarfare/Proposal/JSON)
 * Modify the BookManager code to create and interact with a JSON representation of the book
 * Create a user-friendly form to allow a user to easily adjust the book structure without editing the JSON directly
 * Add functionality to automatically generate a table of contents on a separate page, which can then be transcluded.
 * Add functionality to automatically generate navigation bars similar to those generated by Wikisource's template. It will offer previous/next chapter navigation, as well as a link to the main landing page. It can also include similar information as that header template (for example, author, categories, portal...)
 * Add functionality to create a simple print version of the book. This will be similar to the "print version" of articles (see for example the print version of the Wikipedia article "Book"): a simplified page that is printer-friendly. Eventually the functionality added by this extension should be used with Extension:Collection, but that is not something I plan to tackle in the main part of this project.
 * Write documentation for the BookManager extension

If time permits
I would like to implement some of the feature requests that depend on a single "book" representation.
 * One-click events that handle an entire book
 * Watchlist
 * Delete
 * Move
 * Protect
 * View recent changes
 * Add an extension or patch to Extension:Collection that will allow it to print the entire book at once
 * Allow books to be collected on a "bookshelf" for later use

Pre-May 27
Familiarize with the MediaWiki core, BookManager, and possibly Collection extensions. Work on stabilizing the BookManager extension. I will also try to replace all deprecated functions with up-to-date ones, and improve the inline documentation.

May 27–June 17
Google allocates this time to the "community bonding period". I am already quite involved with the Wikimedia communities, so I will not need to spend much of this time familiarizing myself with them. I will, however, use this time to ensure that my project has support from the communities it will most dramatically affect (primarily Wikisource and Wikibooks). I will also use this time to become more familiar with the development processes, MediaWiki core, and the BookManager extension. During this time, I will also work with my mentor(s) to draft a very specific plan for the rest of the summer, create design documents, and begin working on the code.

Week 1: June 17–June 23
Finalize JSON schema, with feedback from the Wikisource, Wikibooks, and Wikidata communities on additional metadata they would like to include. Plan for the metadata to be configurable per-wiki, as fields like ISBN would not be as useful for a wiki like Wikibooks.

Week 2–4: June 24–July 14
Modify the BookManager backend so that it can read and store JSON data about each book. Begin adding support for features such as automatically-generated tables of contents and navigation bars, as well as for a print version of the book.

Week 5–7: July 15–August 4
Create the frontend for the extension. This includes both the form that will be used to create and modify the stored data, as well as the landing page for viewing the book. Continue working on the tables of contents, navigation bars, and print versions, if necessary.

Week 8: August 5–August 11
Modify the existing navigation bar to use the JSON data instead of the existing code.

August 12–September 23
Clean-up stage. This involves polishing the code, finishing up any documentation, and testing. I will aim to have the complete, stable extension reviewed and merged by September 2. After this, I will dedicate my time to any existing bugs and to deploying the extension on Wikisource and Wikibooks.

Although this is a long period of time, it will act as a bit of a buffer in case I hit any unexpected snags. I've given a little extra time because my school year starts on September 4, and I want a good three weeks of full-time work on finishing it up. I will still be able to dedicate a large amount of time from September 4 onwards, but it may be in more scattered segments.

If this allotted time period turns out to be too much, I have quite a few small-but-useful projects on my "If time permits" list that I can hack away at.

About you
I am just completing my second year at Northeastern University, where I was studying computer engineering. I have just switched my major to computer science, as I've found I'm much more interested in writing code than I am in working with hardware. My programming language of choice is Python, although I also use C, C++, and Javascript regularly. I am working on becoming more proficient with PHP to prepare for this project.

I have been a Wikimedian for almost seven years. I am most active on English Wikipedia, where I am an administrator. I mainly do maintenance work there, reverting vandalism and cleaning up articles. I also help out with outreach; I've worked on the Wikipedia Education Program (hey, that's even me in the photo!), and I was one of the appeals featured during the 2011 fundraising drive. I also very much enjoy editing the English Wikisource, where I completed the initial proofreading of Sigmund Freud's The Interpretation of Dreams and am now working on proofreading the Pentagon Papers.

I enjoy programming in my free time. My current project is a Python parser to convert the wikimarkup of the Pentagon Papers to LaTeX. When it's at all possible, I make all code I write freely available on GitHub.

Participation
I will work hard to communicate well, whether it be with my mentor, other developers, or the community. I already make a habit of ensuring that I am very easy to contact. While I'm awake, I respond to emails almost immediately and talk page messages within the day. While I'm at my home computer, I am always logged on to IRC and can be easily reached at #wikipedia-en, #mediawiki, #wikisource, or by private message. In terms of my coding style, I commit frequently (no, really, just look at my GitHub commit log), and plan to continue this habit while I work on this project. I will keep a repository for this project on GitHub both for my own use and so that my progress will be easily trackable—this way you will not have to wait for me to submit a finished patch to see what I'm up to. I also plan to blog about this project, probably weekly.

Regarding my interaction with my mentor, Raylton and I have agreed that we will communicate via email at least once daily so that he can keep up with my progress and give feedback. If I run into questions, I will be able to contact him via email as needed. I will also take advantage of IRC if I have smaller problems that may not necessarily require his specific expertise with BookManager.

Past open source experience
As I mentioned in the "About you" section above, I've been contributing to the Wikimedia projects as an editor for almost seven years. I'm very familiar with the various communities, particularly on English Wikipedia. This project is one of my first forays into contributing code to an open source project. I've been working on familiarizing myself with the code base and beginning to contribute; I submitted my first patch at the beginning of April! Since then I've submitted a few more. I've also been communicating a lot with MarkTraceur, who has been very helpful in introducing me to the code, and an exceptional resource when I have questions.

Bugs
There are quite a few bug reports and other various discussions that are related to this project:
 * Dependency tree for Bug 15071
 * Make Collection extension to automatically create collections for existing books on Wikibooks/Wikisources
 * Wikibooks/Wikisource needs means to associate separate pages with books
 * Protect, watchlist or delete a whole book at once
 * Create a set of special pages for handling meta-organization of books
 * List, count and search all books
 * BookManager design (automatic translation)

Feedback
I have requested input on this project in several places:
 * Multilingual Wikisource Scriptorium (also linked from English Wikisource Scriptorium)
 * Thread:User talk:Qgil/Summer of Code proposal feedback
 * Comment on bug 15071
 * On wikitech-l
 * English Wikibooks reading room