PdfBook tips
From
Revision as of 21:12, 7 February 2012 by Perspectoff (Talk | contribs)
PdfBook
(This method is complex and difficult to implement (but robust once accomplished). Compare to the Collections method that Wikipedia uses. This page is undergoing construction.)
Some wiki users like to print out part or all of the wiki into an ebook (PDF format). This can be facilitated with the PdfBook extension. For more information see this article.
- Install the htmldoc module in your OS:
sudo apt-get install htmldoc
- Download and install:
wget http://upload.wikimedia.org/ext-dist/PdfBook-MW1.16-r60653.tar.gz sudo tar -xzf PdfBook-MW1.16-r60653.tar.gz -C /var/lib/mediawiki/extensions sudo rm PdfBook-MW1.16-r60653.tar.gz
- Edit the LocalSettings.php file and add the lines:
# # PdfBook settings # require_once( "$IP/extensions/PdfBook/PdfBook.php" ); # #$wgPdfBookLeftMargin // 1cm Default Left page margin #$wgPdfBookRightMargin // 1cm Default Right page margin #$wgPdfBookTopMargin // 1cm Default Top page margin #$wgPdfBookBottomMargin // 1cm Default Bottom page margin #$wgPdfBookFont // Arial Default font to use if unspecified in content #$wgPdfBookFontSize // 8 Default Point size of default font #$wgPdfBookLinkColour // 217A28 Default Colour to use when rendering hyperlinks in text #$wgPdfBookTocLevels // 2 Default Number of outline levels to use when building the table of contents #$wgPdfBookExclude // empty Default List of article titles which should not be included in the book #
- There will be a Category:Books. Each book will have then its own separate Category named for the book (such as Category:MyBook1). Each chapter (or article) for the book will have a tag assigning it to that Category.
- Create page named Category:MyBook1 and add the lines:
{{pdf}}
{{book
| name = MyBook1
| author = Perspectoff
| buy = [http://mypurchasesite.mydomain.org Purchase Site]<sup>(free delivery!)</sup>
}}
[[Category:Books]]
- Add any descriptive information about the eBook that you like. The chapters/articles to be included will be listed at the bottom as subcategories.
- To each page that will be in the eBook, add a link within the page (top or bottom of the page):
[[Category:MyBook1|042]]
where 042 represents the chapter/article number.
- Edit the Template:pdf page to contain the lines:
{{message|icon=[[File:Book.png|60px]]|text=This selection of articles can be '''[{{fullurl:{{FULLPAGENAMEE}}|action=pdfbook}} downloaded as a PDF book]''' <small>(or as [{{fullurl:{{FULLPAGENAMEE}}|action=pdfbook&format=html}} html only])</small><br><small>(see [http://www.mediawiki.org/wiki/Extension:PdfBook PdfBook extension] for details about this functionality)</small>
}}
- Be sure to upload an image File (in this example named Book.png) to be used as the book icon.
- Edit the Template:Message page to contain the lines:
{|style="width: 100%;margin: 15px 0 0 0;padding: 3px;border: 1px solid #ccc;background: #f4f4f4;text-align: left;vertical-align: top;"
|-
|
{|style="background:none;border:none;margin:0;padding:0;vertical-align:middle;"
|{{{icon|}}}
|{{{text}}}
|}
|}<noinclude>
The message template is used to format other templates. It uses the class=message css tag within MediaWiki:Common.css.
- Usage:
{{Message|icon=[[Image:Info_Icon.png|50px]]|text=This is a test}}
creates:
{{Message|icon=[[Image:Info_Icon.png|50px]]|text=This is a test}}
[[Category:Formatting templates]]</noinclude>
- Edit the Template:Book and add the lines:
<noinclude>{{info|This template should be included within any article which represents a book. The article title should be the same as the title of its corresponding book.<br>Articles which use this template are automatically categorised into [[:Category:Books]].}}
<br>
Until we have a semantic form, you can copy and paste the following parameters from the box into your new book article and replace the asterisks with the correct values
<br>
<pre>
{{Book
|name = [[***]]
|author = [[***]]
|publisher = ***
|buy = ***
|ISBN = ***
|keywords = ***
|image = [[***]]
}}
</pre>
Once you have saved the new article with information about the book, an entry for that book will appear in the [[:Category:Books|books category]] which will look like the example below, with proper values filled in.
[[Category:Required semantic forms]]
</noinclude>
{{Wbox|name=Book: {{{name}}}|content=
{{sbo}}{{!}}cellspacing=0 cellpadding=5 border=0
{{!}}-
{{!}}'''Author'''{{!!}}{{{author}}}
{{!}}rowspan=5 valign=top{{!}}{{#if:{{{image|}}}|[[Image:{{{image}}}|100px|right]]}}
{{!}}-
{{!}}'''Publisher'''{{!!}}{{{publisher}}}
{{!}}-
{{!}}'''Buy from'''{{!!}}{{{buy}}}
{{!}}-
{{!}}'''ISBN'''{{!!}}{{{ISBN}}}
{{!}}-
{{!}}'''Keywords'''{{!!}}{{{keywords}}}
{{!}}{{sbc}}
{{edit this form|Book}}
}}
<includeonly>[[Category:Books]]</includeonly>
<noinclude>[[Category:Records]][[Category:Organisational templates|{{PAGENAME}}]]</noinclude>
- Edit the Template:Info page and add the lines:
{{message|icon=[[File:Info256.png|40px]]|text={{{1}}}}}
<noinclude>[[Category:Formatting templates]]</noinclude>
- Don't forget to upload an Info256.png image as an icon.
- Edit the Template:Wbox page and add the lines:
<includeonly>{| align={{{align|right}}} style="border-spacing:8px; margin:8px;"
{{#switch: {{{colour|purple}}} |
green={{!}} class="MainPageBG" style="width:{{{width|55}}}%; border:1px solid #cef2e0; background:#f5fffa; vertical-align:top; color:#000;"{{!}} |
blue={{!}} class="MainPageBG" style="width:{{{width|55}}}%; border:1px solid #cedff2; background:#f5faff; vertical-align:top"{{!}}|
purple={{!}} class="MainPageBG" style="width:{{{width|100}}}%; border:1px solid #ddcef2; background:#faf5ff; vertical-align:top; color:#000;"{{!}}
}}
{|width="100%" cellpadding="2" cellspacing="5" style="vertical-align:top; background:{#switch: {{{colour|purple}}}|green=#f5fffa;|#faf5ff; color:#000}};"
! <div style="margin:0; background:{{#switch: {{{colour|purple}}}|green=#cef2e0|blue=#cedff2|#ddcef2}}; font-size:120%; font-weight:bold; border:1px solid {{#switch: {{{colour|purple}}}|green=#a3bfb1|#afa3bf}}; text-align:left; color:#000; padding:0.2em 0.4em;">{{#if: {{{content|}}} | {{{name}}} | {{fullurl:{{{name}}}|2=action=edit}} }}</div>
|-
|style="color:#000;"| {{#if: {{{content|}}} | {{{content}}} | {{:{{{name}}}}} }}
|-
|}
|}
</includeonly>
<noinclude>==Usage==
*name = article name, name used in box, if {{{contents}}} is omitted, then the name is a link, and {{{name}}} is transcluded under the box
*contents = optional, if supplied the wikitext is placed under the box
*colour = green|blue|purple (default)
*align = left|center|right (default)
*width = pixel number (300 default)
=== Examples ===
Wikitext content;
<pre>
{{Wbox|name=Foo|content=Fodda|colour=purple|align=center|width=100}}
{{Wbox|name=Foo|content=Fodda|colour=green|align=center|width=100}}
{{Wbox|name=Foo|content=Fodda|colour=blue|align=center|width=100}}
</pre>
Renders;
{| =
|- align="center" valign="top"
| {{Wbox|name=Foo|content=Fodda|colour=purple|align=center|width=100}}
| {{Wbox|name=Foo|content=Fodda|colour=green|align=center|width=100}}
| {{Wbox|name=Foo|content=Fodda|colour=blue|align=center|width=100}}
|}
</noinclude>
BlogMarks
del.icio.us
digg
Fark
Furl
Newsvine
reddit
Segnalo
Simpy
Slashdot
smarking
Spurl
Wists
