Contents | Start | End | Previous: Chapter 7: Creating Personalised Books | Next: Change Log


Appendix A: A Sample Script

Here’s a sample of a Jutoh script that creates a new Jutoh project from an ODT file, sets properties, adds different covers for Epub and Mobipocket, inserts an ODT fragment, and compiles Epub and Mobipocket ebook files. You can find a more complete example with the relevant script and input files on the Jutoh web site.

;;; encoding=utf-8

[Lena]

actions=import,setproperties,compile,check

configs=Epub:epub,Mobipocket:mobi

source=Lena.odt

title=Lena

project=subdir/%TITLE%_%AUTHOR%

author=Felix Carswell

author_ordered=Carswell, Felix

copyright=(c) Felix Carswell

date=2011

description=A girl meets a boy in a café.

cover:Epub=Lena.jpg

cover:Mobipocket=Trees.dtempl

ISBN:Mobipocket=1111111111111

ISBN:Epub=2222222222222

 

deleteexistingproject=yes

abortonerror=no

 

; pattern, style, pagebreak

splitmethod=pagebreak

splitpattern=Chapter*

splitstyle=Heading 1

 

; simple, fromheadings, none

toc=fromheadings

tocmaxlevel=3

removefromtoc=License Notes|Some other heading|And another

 

; yes to parse CSS, no to use simple styles

import.parsecss=no

import.firstparagraphstyle=Body Text

import.subsequentparagraphstyle=Body Text First Indent

 

; simple, none

titlepage=none

 

; Stylesheet to import on new project creation. Can be importstylesheet or mergestylesheet

mergestylesheet=MyStyles.stylesheet

 

insertfile=file:"TextChunk.odt";new-section:"My Text Chunk";after-section:"Lena"

insertfile=file:"TextChunk.odt";in-section:"Lena";at-end:"yes"

insertfile=file:"TextChunk.odt";in-section:"Lena";at-start:"yes"

insertfile=file:"TextChunk.odt";in-section:"*";keyword:"%MYTEXT%"

insertfile=file:"TextChunk.odt";in-section:"*";before-text:"In my"

insertfile=file:"butterfly.png";in-section:"Chapter 2";keyword:"%BUTTERFLY%";name:"butterfly";id:"image1"

 

objects.butterfly.url=value:"http://www.jutoh.com"

objects.image1.maxwidth=100%

 

configs.*.Maximum image width=999

configs.Epub.HTML left margin=10

strings.*.TESTSTRING=Hello, this is a test string!

 

; document property can be tags, guide, filename, showintoc, showinnavmap, showinspine, notes

; This makes Chapter 1 the start section

documents.Chapter 1.guide=start

 

; The next three lines exclude Chapter 4 and Chapter 5 from the Mobipocket ebook

documents.Chapter 4.tags=notsample

documents.Chapter 5.tags=notsample

configs.Mobipocket.Exclude sections matching tags=notsample

 

; Experimental

; match-text can take wildcards, with * and ? escaped by double-backslash if necessary.

; match-text can't be used to replace text, only styles.

search=match-text:"*\\* \\* \\**";replace-paragraph-style:"Centre"

search=find-text:"In my job";replace-text:"In my incredibly interesting job"

;search=find-paragraph-style:"Normal";replace-paragraph-style:"Body Text"

search=find-paragraph-style:"Heading 2";replace-paragraph-style:"Heading 2 With Page Break"


Contents | Start | End | Previous: Chapter 7: Creating Personalised Books | Next: Change Log