User:Tpt/Book

Abstract
Wikibook and Wikisource are two wikis that don't provide content based on the "article" entity but on a book entity that regroup more than one page. But MediaWiki software is done to provide a powerful system for an article-based contents. So Wikibook and Wikisource need a way to say to the software "this group of page is a book", but it's not possible currently. The goal of this proposal is to implement a MediaWiki extension that adds to MediaWiki the support for the book entity and that will be usable by both Wikibook and Wikisource projects.

The main idea is to consider, as the epub file standard does, the book as a list of pages around a structured table of contents with some metadata about it (title, author...). The metadata and the table of contents are stored in a page of main namespace and parts of the book are subpages of this page but can also standard pages.

Requirements

 * 1) This extension must be adapted to both books written by contributors (Wikibook) and books written by some people and only reproduced in the wiki (Wikisource). So we need to let the wiki store "this book is written by XXX" or "this book is written by the contributors of its parts". This can be done by providing metadata in the main page.
 * 2) This extension must be adapted to Wikisource workflow, ie the proofreading system managed by the ProofreadPage extension. The ProofreadPage transclusion system must be compatible with this new extension.
 * 3) The extension must allow an easy migration from the current system and keep history of content.
 * 4) The extension must provide an easy way to export content offline using standards like epub.
 * 5) The extension must provide an API to retrieve metadata about the book.

Main idea
A book is, I think, mainly the regrouping of some parts contained in pages around a main page that contains metadata about the book (title, subtitle, Universal Decimal Classification identifier...), an introduction, a conclusion and a structured list of its parts. So, a good way to implement book structure is maybe to provide a standardized way to set up metadata, list of chapters, introduction and conclusion in a Mediawiki page and put the parts of the books in sub-pages of this page. But in order to allow to have the same chapter in more than one book, the book can contain also other pages of the main namespace.

The main page is not a standard main page with only a field of free text but a structured page. The edition system shows inputs for setting metadata, wikitext fields for the introduction and the conclusion of the book and a place to setup easily the table of contents. This table of contents is a tree of links with their labels, this links can contain anchor to link to a specific title of the page. The rendering of the page from these data is done by the extension but the html output must be designed to be easily styled by wikis that want to keep their own graphic chart. The metadata and the table of contents can be transcluded from an "index" page in order to avoid any duplication of content.

The other pages contains free wikitext as usual (this wikitext may contain, between other things found, instruction of transclusion from Page namespace of Wikisources). The main page edition mode may provide a way to edit chapters without leaving the main page. A navigation system is setup automatically by the extension for pages that are subpages of a main page and that are contained into the table of contents of the main page in order to allow an easy navigation inside the book.

The rendered mainpage may also contain a toolbar in order to export the book in pdf and epub. This export may be done by Collection or by an improved version of Wsexport integrated in the extension.

Technical proposal
TO BE WRITTEN