Manual Generation 3.0 Prince

From Gramps
Revision as of 00:03, 24 December 2012 by Patsyblefebre (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Sample

Download: complete offline manual for GRAMPS 3.3 (8 MiB)

Converted with Prince 8.0 beta 1, according to the workflow below. Line numbers start anew for each chapter.

Workflow

Proceed as follows for converting one chapter in the manual to PDF, two columns, A4, landscape, with full resolution images.

  1. Download the raw HTML of the chapter's wiki page.
  2. Edit the HTML:
    1. Replace:
      • From: src="/
      • To: src="http://www.gramps-project.org/
    2. Regexp-replace (EMACS syntax):
      • From: \(http://www.gramps-project.org/wiki/images/\)thumb/\([^/]*/[^/]*/[^/]*\)/[^"]*
      • To: \1\2
    3. Regexp-replace:
      • From: width="[0-9]*" height="[0-9]*" \(class="thumbimage"\)
      • To: \1
    4. Regexp-replace:
      • From: \(class="thumbinner"\) style="width:252px;"
      • To: \1
  3. Load the edited HTML in a browser, and then download it together with all images, for local browsing.
  4. Convert the modified web-page with images to PDF, using Prince XML and the CSS below.

CSS

/*

  CSS style sheet for Wikipedia articles.

  Written by Hakon Wium Lie March 2008.

  Modified by Felix E. Klee <felix.klee@inka.de> in 2011.

  This style sheet may be reused by anyone for any purpose.

  Here's an example of how to use the style sheet:

  prince --no-author-style -s http://www.princexml.com/howcome/2008/wikipedia/wiki2.css http://en.wikipedia.org/wiki/Winter_war -o foo.pdf

*/

@import url(http://www.princexml.com/fonts/gentium/index.css);

/* set headers and footers */

@page {
  size: a4 landscape;
  margin: 2cm;
  font: 11pt/1.3 "Gentium", serif;

  @top-right { 
    content: string(title);
    font-style: italic;
  }
  @top-left { 
    content: string(source);
    font-style: italic;
  }
  @bottom-center {
    content: counter(page);
    vertical-align: top;
    padding-top: 1em;
  }
}

#siteSub { string-set: source content() }

/* basic style settings*/

body {
  font: 10pt/1.3 "Gentium", serif;
  prince-linebreak-magic: auto; 
  prince-image-resolution: 500dpi;
  hyphens: auto;
  text-align: justify;
  columns: 2;
  column-gap: 1.5em;
/*
  columns: 3;
  column-gap: 1em;
*/
}

ul, ol, dl { text-align: left; hyphens: manual; }

h1, h2, h3, h4, h5, h6 { 
  line-height: 1.2;
  padding: 0;
  margin: 0.7em 0 0.2em; 
  font-weight: normal;
  text-align: left;
  page-break-after: avoid;
  clear: both;
}

a { text-decoration: none; color: inherit; }

p { padding: 0; margin: 0 }

blockquote p {
  font-size: 1em;
  font-style: italic;
}


/* text indentation */

p + p { text-indent: 1.5em }
div.thumb + p { text-indent: 1.5em }
h2 + div.thumb + p { text-indent: 0 }
h3 + div.thumb + p { text-indent: 0 }
h2 + div.thumb + div.thumb + p { text-indent: 0 }
h3 + div.thumb + div.thumb + p { text-indent: 0 }
h2 + dl + div.thumb + p { text-indent: 0 }
h3 + dl + div.thumb + p { text-indent: 0 }


div + div.thumb + p { text-indent: 0 }


#toc { display: none }


ul { 
  list-style-type: disc;
  margin-left: 1.3em;
}

/* put article heading on top of the page, spanning all columns */

h1.firstHeading { 
  float: top; 
  string-set: title content();
  padding-bottom: 0.2em;
  border-bottom: thin solid black;
  margin-bottom: 1em;
}


#footer { padding-top: 1em }
#footer ul { 
  list-style-type: none;
  margin-left: 0;
}

#footer li { display: inline }
#footer br { display: none ! important }
#privacy, #about, #disclaimer { display: none }

/* images */

.thumb, .thumbinner, img, .thumbcaption { 
  border: none; margin: 0; padding: 0;
  page-break-inside: avoid;
}

.thumb { 
  margin: 0.2em 0;
  float: prince-column-top-if-necessary; 
}

.thumb img {
  width: 100%;
  height: auto;
}

.thumbcaption { 
   background: #fff; 
   text-align: left; 
   font-style: italic;
   font-size: 1em;
   line-height: 1.2em;
   padding-bottom: 0.3em;
   border-bottom: thin solid gray;
   margin-bottom: 1em;
}

div.magnify, div.LanguageLinks, div.printfooter, #catlinks, #column-one {
    display: none;
}

div, img { max-width: 100% }

body {
  prince-image-resolution: 1000dpi;
}