Difference between revisions of "Documentation/Dashboard/Wiki Books"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Export wiki pages from the wiki)
(Wiki Books Project)
Line 4: Line 4:
 
The objective of this project is to implement a solution that allows compilations of wiki pages to be exported as books in ODF and/or PDF.
 
The objective of this project is to implement a solution that allows compilations of wiki pages to be exported as books in ODF and/or PDF.
  
===Steps===
+
==Steps==
  
====Define a sequence of wiki pages to make up a book====
+
===Define a sequence of wiki pages to make up a book===
 
The documentation wiki makes use of [[Template:Documentation/MasterTOC|TOC templates]] to define a wiki book.  
 
The documentation wiki makes use of [[Template:Documentation/MasterTOC|TOC templates]] to define a wiki book.  
  
====Export wiki pages from the wiki====
+
===Export wiki pages===
This includes recursively parsing the pages referenced by the main TOC (for sub-TOCs) and remembering the page level for later heading adjustments.
+
This includes recursively parsing the pages referenced by the main TOC (for sub-TOCs) and remembering the page level for later heading adjustments. Transcluded content needs to be resolved.
 +
 
 +
The wiki page needs to be fetched as wiki text, not rendered HTML. This can either be done using the [http://www.mediawiki.org/wiki/API mediawiki api.php] or the [[Special:Export|export page]]. Note, that both
 +
pages use a different XML wrapper for the output.
  
 
  parse(mainTOC)
 
  parse(mainTOC)
Line 22: Line 25:
 
       parse(subTOC)
 
       parse(subTOC)
 
     endif
 
     endif
 +
    resolvetransclusions
 
   endfor
 
   endfor
 
  endsub
 
  endsub
  
====Resolve transcluded content====
+
====Fetching a page using the api====
====Download images====
+
 
====Adjust heading levels====
+
/api.php?action=query&titles=$pagename&prop=revisions&rvprop=content
====Convert to ODF or XML====
+
 
====ODF: Apply template to ODF (define template)====
+
====Fetching a page using the Export function====
====ODF: Load in OOo, adjust layout and export PDF====
+
 
====XML: Apply template to producs XML-FO====
+
/wiki/Special:Export/$pagename
====XML: Render PDF====
+
 
 +
===Download images===
 +
===Adjust heading levels===
 +
===Convert to ODF or XML===
 +
===ODF: Apply template to ODF (define template)===
 +
===ODF: Load in OOo, adjust layout and export PDF===
 +
===XML: Apply template to producs XML-FO===
 +
===XML: Render PDF===

Revision as of 14:55, 14 November 2007

Template:Documentation/BeingEdited

Wiki Books Project

The objective of this project is to implement a solution that allows compilations of wiki pages to be exported as books in ODF and/or PDF.

Steps

Define a sequence of wiki pages to make up a book

The documentation wiki makes use of TOC templates to define a wiki book.

Export wiki pages

This includes recursively parsing the pages referenced by the main TOC (for sub-TOCs) and remembering the page level for later heading adjustments. Transcluded content needs to be resolved.

The wiki page needs to be fetched as wiki text, not rendered HTML. This can either be done using the mediawiki api.php or the export page. Note, that both pages use a different XML wrapper for the output.

parse(mainTOC)

sub parse(TOC)
  load(TOC)
  foreach entry(TOC)
    parse(entry)
    if contains(subTOC)
      level++
      parse(subTOC)
    endif
    resolvetransclusions
  endfor
endsub

Fetching a page using the api

/api.php?action=query&titles=$pagename&prop=revisions&rvprop=content

Fetching a page using the Export function

/wiki/Special:Export/$pagename

Download images

Adjust heading levels

Convert to ODF or XML

ODF: Apply template to ODF (define template)

ODF: Load in OOo, adjust layout and export PDF

XML: Apply template to producs XML-FO

XML: Render PDF

Personal tools