User:Whiteknight/Print Version Gadget

Print Version Gadget (Version 3.05)
Warning: This gadget is deprecated and is no longer maintained. Use the Visual Book Designer instead.
If you would like to create a print version for a book, type the name of the page that contains the TOC of your book here and click Load to load the page. Click Show to display a textbox where you can enter the text manually. Click Convert to convert the text to a printable version.
You must install User:Whiteknight/printversion.js to interact with this element. Installation instructions located at User:Whiteknight/Print Version Gadget

How to Install edit

Warning: This template is deprecated and will no longer be maintained or updated. This script is a Gadget. You can install this script by going to Special:Preferences, going to the "Gadgets" tab, and checking the box labeled Print Version Creator.

Once you save your javascript, you may need to clear your cache, typically by pressing + , or some other key combination, depending on your browser.

IE7 IE6 FF2 FF3 Safari Chrome Opera9
Works Works Works Works Works Works Works
Browser Test Codes
Broken: The script does not work in this browser.
Partial: Some (but not all) features of the script work in this browser. Problems may be minor and will probably be listed.
Works: The script works as expected in this browser, and no obvious bugs or errors are present.
Not Tested: I have not tested this script on this browser. It might work, it might not. If you test it, let me know the results.
Browsers not listed here have not been tested or are known not to work

Known Issues edit

Safari & Chrome (Webkit)
Opening an embedded edit window does not work. You must "Display" the text and copy+paste it into another edit window.

About This Gadget edit

This gadget produces a print version from provided text. It converts wikitext from a book TOC into a printable version. Notice that it does not convert plain text, it must be a properly formatted TOC. TOCs with complex or non-standard formatting may not convert properly, and will need to be edited.

The following wikitext:

 * [[/Page 1/]]
 === Sub Heading ===
 * [[/Page 2/]]
 * [[/Page 3/]]
 

Will be converted to the following Print version text:

 {{Print chapter heading|Page 1}}
 {{:BookName/Page 1}}
 
 {{print unit page|Sub Heading}}
 
 {{Print chapter heading|Page 2}}
 {{:BookName/Page 2}} 
 
 {{Print chapter heading|Page 3}}
 {{:BookName/Page 3}} 
 

The templates {{print unit page}} and {{print chapter heading}} are print-only formatting templates that create special pages, page breaks, and headings for different purposes.

How to Use This Gadget edit

Here are a brief set of instructions on how to use the Print Version Creator. For more help, ask Whiteknight.

Get the TOC Text edit

First, you need to load the text of the TOC into the gadget. There are two methods to do this:

  1. Enter the name of the TOC page in the edit box and click Load.
  2. Click Show to display a textbox, and enter the text to convert in the box.

Using option 1, if you load an existing TOC, the text of that page will be inserted into the textbox. Clicking Show will display the text of the page for you to edit. It is recommended that you remove formatting, including templates, images, categories, tags (noinclude, includeonly, nowiki, etc), magic words (NOTOC, FORCETOC, etc) and tables. The gadget can try to remove some of these things, but the algorithm is not perfect.

Converting the Text edit

Once you have a TOC loaded into the textbox, you can click the Convert button to produce the printable version text. Once you have converted the text, you have two options:

  1. Display. Display the printable version of the page, for copy+paste.
  2. Edit. Produce an edit window, with the printable version code already loaded. Edit the code and press "Save page" to create the PV.

The Display button will display the completed text of the printable version. If you notice problems, you can click Show to view the TOC text, make any necessary changes, and click Convert again. The Edit button will display an edit window for the page "ROOTBOOKNAME/Print Version", with the text of the printable version already loaded into the edit window. You can make any necessary changes, and then click Save page to save the printable version.

Notice
Edit does not work in Safari. Display and all other functionality should work in all other browsers.

To Do edit

  • Add ability to post a {{Print version}} notice on the front page of the book.
  • Account for nowiki, noinclude, and includeonly tags
  • Account for text-formatting (bold and italics)
  • Account for tables
  • Handle external links in single brackets and unbracketed
  • Fix bugs in the conversion algorithm
  • rearrange buttons to look better

Version History edit

  • 3.05 A number of small fixes, added unit pages, etc.
  • 3.03 Nearly-perfect IE support
  • 3.02 Improved IE support
  • 3.01 Minor fixes, added partial support for IE
  • 3.00 Complete rewrite, using Gadgetscore v2.0. same functionalty but better code.
  • 2.55 Fixed XML translation thing
  • 2.54 Updated to include gadgetscore framework
  • 2.53 Minor refactor
  • 2.52 Added automatic edit summary for "Edit"
  • 2.51 changed "Edit" text to be more instructive
  • 2.50 several minor and major changes, code refactor, converted text not stored in textbox.
  • 2.02 Disabled "display" and "edit" buttons when there is no converted text.
  • 2.01 Minor aesthetic enhancements
  • 2.00 Complete rewrite, addition of several features, simplification of code.
  • 1.01 Refactored javascript and template
  • 1.00 First stable version