Wiki-to-print

From creative crowd wiki
Jump to navigation Jump to search

About wiki-to-print

Wiki-to-print is a collective publishing environment based on MediaWiki software[1], Paged Media CSS[2] techniques and the JavaScript library Paged.js[3], which renders a preview of the PDF in the browser. Using wiki-to-print allows us to work shoulder-to-shoulder as collaborative writers, editors, designers, developers, in a non-linear publishing workflow where design and content unfolds at the same time, allowing the one to shape the other.

Following the idea of "boilerplate code" which is written to be reused, we like to think of wiki-to-print as a boilerplate as well, instead of thinking of it as a product, platform or tool. The code that is running in the background is a version of previous wiki-printing instances, including:

  • the work on the Diversions[4] publications by Constant[5] and OSP[6]
  • the book Volumetric Regimes[7] by Possible Bodies[8] and Manetta Berends[9]
  • TITiPI's[10] wiki-to-pdf environments[11] by Martino Morandi
  • Hackers and Designers'[12] version wiki2print[13] that was produced for the book Making Matters[14]

So, wiki-to-print/wiki-to-pdf/wiki2print is not standalone, but part of a continuum of projects that see software as something to learn from, adapt, transform and change. The code that is used for making this journal is released as yet another version of this network of connected practices[15].

This wiki-to-print is hosted at CC[16] (creative crowds). While moving from cloud to crowds, CC is a thinking device for us how to hand over ways of working and share a space for publishing experiments with others.

Create a wiki-to-print environment


 


How to work with wiki-to-print?

Wikis are great for (a-sync) collaborative writing and editing, which is why the MediaWiki software is a part of wiki-to-print. Alongside this, concepts such as transclusion are useful in allowing you to collate a publication from many differently authored pages by referring to them in hypertext. Simply put, transclusion is including a part of a document into another one by hypertext reference, rather than copying it. Pages (or parts of them) can be transcluded into another wiki page, as so:

{{:name of page to be transcluded}}

Wiki-to-print uses the Pdf namespace to make an environment in which PDFs can be written, edited and designed by multiple people simultaneously. After creating a wiki-to-print environment in the Pdf namespace, some useful wiki-to-print features are automatically added that allow you to render a wiki page into a HTML page and PDF document.

So once you have made a new wiki-to-print environment, a range of pink buttons are added to the navigation bar, which include:

CSS!

Here you can add the style for your print layout.

The Talk pages in the Pdf namespace are turned into CSS stylesheets for each particular wiki-to-print environment. So, once you have created a new wiki-to-print environment, an empty CSS stylesheet is also made.

View HTML

Here you can inspect the HTML and CSS of your page.

If you want to preview the content as HTML, you can do this by clicking this button. This can be helpful to do when, for example, something unexpected happened in your layout and you want to figure out what is happening. You can also see the CSS alongside the rendered HTML in the same browser window.

View PDF

Here you can preview your PDF.

Clicking this button allows you to preview the content as a PDF in a new browser tab. Here, your content and the page layout you specified in your CSS are rendered by the JavaScript library Paged.js to look like a PDF. If you are satisfied with this, you can export the PDF from this browser tab simply by pressing ctrl/command + p. If you have any problems seeing the layout, it's useful to check that your content and CSS is written correctly by viewing and inspecting how the HTML is rendered.

Update text

Here you can update your text after making changes.

Any changes to text in your wiki-to-print environment (such as in content, or CSS) need to be updated before you can view them in the PDF. This also applies to any pages that are transcluded into your wiki-to-print environment. Clicking this button opens a new browser tab, as a sign that you have now updated the text. You can safely close it afterwards.

Update Media

Here you can update your text + media after making changes.

Any changes to media in your wiki-to-print environment (such as new images you upload) need to be updated before you can view them in the PDF. This also applies to any pages that are transcluded into your wiki-to-print environment. Clicking this button opens a new browser tab, as a sign that you have now updated the media. You can safely close it afterwards.

Links to get started with

How does wiki-to-print work?

Technically seen, wiki-to-print is a web application made with Flask, that can be installed on the same server as where the MediaWiki is installed.

In practice, it's a DIY configuration that glues different things together: it takes a wiki page and a CSS stylesheet as input sources and renders them into a HTML page and a PDF preview page.

The source code can be found at: https://git.vvvvvvaria.org/varia/wiki-to-print/

To install wiki-to-print:

  • make setup: makes a virtual environment and installs all the requirements
  • edit config.json

To run wiki-to-print:

  • make local: runs the Flask application locally
  • make server: runs the Flask application remotely with Gunicorn, which we used to work with a subdirectory (we use https://cc.vvvvvvaria.org/wiki-to-print/ as the root of this Flask application)

The Flask application is based around the following URLs/routes:

button URL/route Flask action
CSS https://cc.vvvvvvaria.org/wiki-to-print/static/Test.css renders PdfCSS:Test as CSS stylesheet
HTML https://cc.vvvvvvaria.org/wiki-to-print/html/Test renders Pdf:Test as HTML page, using PdfCSS:Test as CSS stylesheet
PDF https://cc.vvvvvvaria.org/wiki-to-print/pdf/Test renders Pdf:Test as PDF preview page (using Paged.js), using PdfCSS:Test as CSS stylesheet
Update text https://cc.vvvvvvaria.org/wiki-to-print/update/Test downloads all the text from Pdf:Test using the Mediawiki API and saves it to Test.json (in HTML)
Update Media https://cc.vvvvvvaria.org/wiki-to-print/update/Test?full=true downloads all the text + images from Pdf:Test using the Mediawiki API and saves them to ./static/images/

For more installation guides, see: Running wiki-to-print on the server

Created wiki-to-print environments

These are some wiki-to-print environments that have been used so far:

wiki-to-print log

See the issue tracker of the git repository: https://git.vvvvvvaria.org/varia/wiki-to-print/issues