Rhaptos Labs

A place for experimental code and early prototypes developed by the Connexions team, Connexions Consortium members, and the development community at large. We will continue to refine the display here, and please feel free to send us pointers to new work we should be adding. Send to cnx@….

Convert CNXML to Docbook for EPUB and PDF generation

NOTE: Part of this code has made it out of Rhaptos Labs and onto cnx.org (and very soon in the Rhaptos release). Connexions is now using docbook to create EPUBs.

http://cnx.org/help/viewing/epub-download-screenshot-crop-drop-shadows.png

Currently: we use LaTeX to generate PDF documents but automatic generation of LaTeX is cumbersome to maintain. This project aims to use the Docbook XML format and XSL stylesheets to generate PDF documents (using XSL-FO) and EPUB ebook documents.

We currently convert ~80% of the existing cnxml in our repository to Docbook by a manual process.

Goals: Automate the generation of Docbook, PDF, and EPUB files when a Collection or module is published.

Example EPUB and PDF files of our most popular material

Source Code

Import/Export Google Docs-friendly HTML

Currently: We provide a single web-based editor for CNXML and it requires knowledge of our XML format. Collaboration is limited to our website. Google Docs is not a general-purpose HTML editor and generates a subset of HTML. Notions like exercises and problem sets, while not directly representable in HTML, can be encoded as headings with a special prefix (i.e. "Problem: What are the prime factors of 60?")

Goals: Have a round-trippable XSLT that either:

  • Does the "right thing" for HTML tags (A bold tag is converted to a "cnx:emphasis type='strong'" tag)
  • Cnx tags that do not have a direct representation are encoded so they can still be edited in Google Docs
  • Falls back to a "safe" default conversion (A heading without a prefix is converted to a cnxml section element)
  • The tags are encoded (in a not-so-obvious way) so no cnxml is lost.

Beta Version (Firefox only)

http://mountainbunker.org/~schatz/trac-images/html-editor.png

Allow direct editing in Google Docs

Currently: Authors must use our editor to make changes and collaborate using our workgroups. With Google-friendly HTML (described above) and using Google APIs authors could "edit" a module using Google Docs, publish it using Connexions, which pulls the document from Docs, converts it to cnxml and publishes it.

Goals: Allow authors to either log in using their google email or link to their account. Using APIs, create a Google Doc, populate it with content from a module, and upon publication, pull the HTML from Google Docs and publish it.

Provide a WYSIWYG Editor for cnxml using kupu or TinyMCE

Currently: Authors use our Edit-In-Place UI for editing cnxml. With a round-trip HTML conversion, we culd use kupu (a Javascript HTML editor used by Plone) or TinyMCE and add additional buttons and screens for editing Connexions-specific elements (like linking to other modules).https://software.cnx.rice.edu/svn/labs/alpha/cnxml.editor/ https://trac.rhaptos.org/trac/rhaptos/browser/labs/alpha/cnxml.editor

Goals: Build Javascript buttons and tools for kupu that allow editing cnxml elements.

Decouple Authoring/Publishing/Viewing

Currently: Authoring is the slowest part of our website. All three are tightly integrated and the code has elements of all three interleaved. Outside developers need to know Python, Plone, and how Authoring/Publishing/Viewing all work before making meaningful contributions.

By decoupling Authoring/Publishing/Viewing improvements can be made without affecting the rest of the system.

Goals: Use an http API to communicate between the 3 services.

Offer Customizing Pipeline for Publication

Currently: Customizing textbook layout is a manual and costly process taken up by internal developers. The pipeline is linear and there are several places where authors could "plug in".

Assuming we start using Docbook for PDF generation, a pipeline would like the following (parenthesized entries are points for author-supplied stylesheets):

  • Module text is stored in some XML format (could be cnxml, Docbook, HTML, or some other format)
  • (Authors can convert that format to our standard internal representation, or use one of the exsting converters. Docbook allows annotations that are ignored unless the author supplies XSL templates that match them)
  • Non-customized HTML is generated at this point for rendering on the Connexions website
  • The XML is converted to XSL-FO (At this point, the XML may contain annotations. Authors can "skin" the resulting PDF here by adding a custom XSLT here)

Provide Static Files for Published Material

Currently: Every page on our site is dynamically generated. The reasons for this are:

  • If we change the look of published material (change the layout, portlets, navigation) we would have to recalculate all published material.
  • Logged in users are given additional navigation items on the page.

Once material is published, the only times a page can change are:

  • If it added to a collection or lens
  • If the site layout changes
  • If PDF generation finishes
  • Whether the user is logged in

This project proposes leveraging the user's browser to make the page. If we publish JSON files in addition to static HTML snippets that just contain the module, the users web browser can assemble the page. Also, navigating to other pages would not necessarily require a page reload (similar to Facebook or gmail).

Goals: determine what additional files are necessary to enable AJAXy navigation and rendering of published material.

Easy one-click Google-Translate assisted translations

Currently: Much of our viewers are from non english-speaking countries. Providing a translation is a long process (creating an account, learning our process, learning cnxml, etc). We can use notice from browser headers that they are in another country and use Google Translate to assist them with translating the page and submitting it back to the original authors.

Goals: Use the Google Translate AJAX API to allow paragraph-by-paragraph edits that are sent to the original author

http://mountainbunker.org/~schatz/trac-images/translate.png

Allow other services during publication

By decoupling the publishing API, we can add new pieces as needed. Examples:

  • EPUB/PDF generation
  • Submittion to lulu, Scribd
  • Updating a facebook feed (sending a status message)
  • Custom ping to an author-supplied URL