Module Guide¶
Validator¶
Validator validates XML files against a Relax NG.
Configuration¶
To use Validator module, a processor has to provide a validator.ini
configuration file.
You have 2 groups of sections to write.
Input Section Group¶
[Input]
file_regex = \.xml$
content_regex = <publi(set|doc|quiz)
RelaxNG Section Group¶
[RelaxNG]
publiset = %(here)s/RelaxNG/publiset.rng
publidoc, version 1.0 = %(here)s/RelaxNG/publidoc.rng
publiquiz, version 1.0 = %(here)s/RelaxNG/publiquiz.rng
LePrisme¶
LePrisme is a transformation module which uses regular expressions, XSL and, possibly, python scripts to do its job.
Configuration¶
To use LePrisme module, a processor has to provide a leprisme.ini
configuration file.
You can have up to 7 groups of sections to write.
Initialization Section Group¶
[Initialization]
directories = Images, Audios, Videos
templates = Publidoc2XHtml
script =
[template:Publidoc2XHtml]
path =
exclude =
exclude[!js] = Js, pulse.gif
Input Section Group¶
[Input]
is_dir = false
file_regex = \.xml$
content_regex = <publi(doc|set)
unzip =
validate = true
image.ext = svg, png, tif, tiff, jpg, jpeg, eps, gif
audio.ext = wav, ogg, aac, ac3, mp3
video.ext = dv, mpg, mov, avi, webm, flv
[RelaxNG]
publiset = %(here)s/RelaxNG/publiset.rng
publidoc = %(here)s/RelaxNG/publidoc.rng
Transformation Section Group¶
[Transformation]
preprocess = %(here)s/lib/publidoc2xhtml_pre.py
preregex = %(here)s/Regex/publidoc2xhtml_pre.regex
preregex.files =
xsl = %(here)s/Xsl/publidoc2xhtml.xsl
postregex = %(here)s/Regex/publidoc2xhtml_post.regex
postregex.files = \.html$
postprocess = %(here)s/lib/publidoc2xhtml_post.py
- preprocessand- postprocessare Python scripts which are executed respectively as first and last action.
- preregexand- postregexare regular expression lists which are applied respectively just before and just after XSL transformation.
- preregex.filesand- postregex.filesare a regular expression to select files on which you apply- preregexor- postregexregular expression in addition to the main file.
- xslis a XSL file.
Each processing is optional, but you must have, at least, one processing.
You can have several transformation sections like [Transformation] and
[Transformation:csv] or [Transformation:1] and
[Transformation:2]. They are excecuted in the order of the INI file.
Output Section Group¶
[Output]
make_id = token
format = %(fid)s.epub
container = OCF
validate = false
make_id defines how to transform a name into an ID. The default mode is
token. We have the following modes:
- standard: it replaces spaces and non alpha or non numerical characters by _ and convert in lower case.
- token: as- standardplus accent removal.
- class: as- tokenminus lower case conversion.
- otherwise, it tries to load make_idas a module and executes itsmake_id(filename)method.
Available containers are:
- Zip: create a ZIP archive with the contentof the output.
- OCF: create a Open Container Format file. This container has three parameters.
[container:OCF]
root = Container~
manifest = OEBPS/package.opf://opf:manifest
checker = java -jar %(here)s/Jar/epubcheck.jar %(ocffile)s
- rootis the relative path to the root directory to archive.
- manifestis a string like- <relative_path_to_opf>:<xpath_to_manifest>where- <relative_path_to_opf>is a relative path to OPF file and- <xpath_to_manifest>a XPATH expression to select manifest tag.
- checkeris optional and is the command line to validate archive content.
Finalization Section Group¶
[Finalization]
remove_regex = (~|\.tmp)(\.\w{1,4})?$
script =
Publiseter¶
Publiseter converts a pack into a Publiset XML file.
Configuration¶
To use Publiseter module, a processor has to provide a publiseter.ini
configuration file.
You have up to 5 sections to write.
Initialization Section Group¶
[Initialization]
directories = Images, Audios, Videos
RelaxNG Section Group¶
[RelaxNG]
publiset = %(here)s/RelaxNG/publiset.rng
publidoc = %(here)s/RelaxNG/publidoc.rng
Transformation Section Group¶
[Transformation]
xsl = %(here)s/Xsl/publiset4publidoc.xsl
Output Section Group¶
[Output]
format = %(fid)s.xml
validate = true
Finalization Section Group¶
[Finalization]
remove_regex = (~|\.tmp)(\.\w{1,4})?$
Generator¶
Generator generate from scratch a content. It can be used to fill a pack or to process background jobs.