<p:declare-stepxmlns:p="http://www.w3.org/ns/xproc"xmlns:px="http://www.daisy.org/ns/pipeline/xproc"xmlns:pef="http://www.daisy.org/ns/2008/pef"xmlns:dc="http://purl.org/dc/elements/1.1/"version="1.0"px:input-filesets="obfl"px:output-filesets="pef"type="px:obfl-to-pef.script"exclude-inline-prefixes="#all">
<p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h1px:role="name">OBFL to braille</h1><ppx:role="desc"xml:space="preserve">Transforms an Open Braille Formatting Language (OBFL) document into an embosser ready braille document.</p>
<apx:role="homepage"href="http://daisy.github.io/pipeline/Get-Help/User-Guide/Scripts/obfl-to-pef/">
Online documentation
</a>
<address>
Authors:
<dlpx:role="author">
<dt>Name:</dt>
<ddpx:role="name">Bert Frees</dd>
<dt>E-mail:</dt>
<dd><apx:role="contact"href="mailto:bertfrees@gmail.com">bertfrees@gmail.com</a></dd>
</dl>
</address>
</p:documentation>
<p:inputport="source"px:media-type="application/x-obfl+xml">
<p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">Input OBFL</h2><ppx:role="desc"xml:space="preserve">The OBFL document to convert.
An [OBFL (Open Braille Formatting
Language)](https://mtmse.github.io/obfl/obfl-specification.html)
document describes how text is to be formatted and transcribed to
braille. The text may also have been transcribed to braille already.
The typical use case is when the "OBFL" output of one of the braille
production scripts has been edited, and needs to be transformed to a
formatted braille document.
The following special metadata
([`meta`](https://braillespecs.github.io/obfl/obfl-specification.html#L587))
fields in the "http://www.daisy.org/ns/pipeline/" namespace are
supported:
- `style-type` (supported value: "text/css"): specifies the media type of
[`style`](https://braillespecs.github.io/obfl/obfl-specification.html#L8491)
elements. The value "text/css" indicates that the styles (`name`
attributes) are to be interpreted according to [braille
CSS](http://braillespecs.github.io/braille-css) rules.
- `css-text-transform-definitions`: zero or more
`@-daisy-text-transform` at-rules containing custom text
transformation definitions, available for use in
[`-daisy-text-transform`](https://braillespecs.github.io/braille-css/#dfn-text-transform)
properties in CSS styles. May be used e.g. to switch between braille
codes, or to apply emphasis.
- `css-hyphenation-resource-definitions`: zero or more
`@-daisy-hyphenation-resource` at-rules containing custom hyphenation
resource definitions for specific languages.
- `css-counter-style-definitions`: zero or more
[`@counter-style`](https://braillespecs.github.io/braille-css/#dfn-counter-style)
at-rules containing custom counter style definitions, available for
use in `-dotify-counter-style` properties.
- `default-mode`: specifies the overall braille transcription
mode/policy, i.e. the mode to be used when no
[`translate`](https://braillespecs.github.io/obfl/obfl-specification.html#L2462)
attribute has been set, or when it has been set to the empty
value. Both the `default-mode` meta field and the `translate`
attribute support the [braille transformer
query](http://daisy.github.io/pipeline/Get-Help/User-Guide/Braille/)
syntax.
- `braille-charset`: specifies the braille character set that is used
to encode braille present in the OBFL. If not specified, Unicode
braille is assumed.</p>
</p:documentation>
</p:input><p:optionname="include-preview"required="false"px:type="boolean"select="'false'"><p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">Include preview</h2><ppx:role="desc"xml:space="preserve">Whether or not to include a HTML preview of the braille result.</p>
</p:documentation></p:option><p:optionname="include-pdf"required="false"px:type="boolean"select="'false'"><p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">Include PDF</h2><ppx:role="desc"xml:space="preserve">Whether or not to include a PDF version of the braille result showing ASCII braille.</p>
</p:documentation></p:option><p:optionname="include-pef"required="false"px:type="boolean"select="'false'"><p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">Include PEF</h2><ppx:role="desc"xml:space="preserve">Whether or not to keep the intermediary PEF file (for debugging).
[PEF (Portable Embosser Format)](https://braillespecs.github.io/pef/pef-specification.html) is an
internal data format used by DAISY Pipeline to represent the final formatted braille document,
before it is converted to another embosser-ready format.</p>
</p:documentation></p:option><p:optionname="output-file-format"required="false"px:type="medium"select="''"><p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">Output file format</h2><ppx:role="desc"xml:space="preserve">The file format in which to store the braille result.
The file format must be expressed in the media query syntax. For example, to select a file format
suited for the U.S., set the option to `(-daisy-locale: en-US)`. To use the braille character set
used in the Netherlands and store to a file with extension ".brl", set the option to
`(-daisy-locale: nl) AND (-daisy-file-extension: \.brl)`.
If left blank, the braille will be stored in
[PEF](https://braillespecs.github.io/pef/pef-specification.html) (Portable Embosser Format).</p>
</p:documentation></p:option><p:optionname="preview-table"required="false"px:type="preview-table"select="''"><p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">ASCII braille table for HTML preview</h2><ppx:role="desc"xml:space="preserve">The ASCII braille table used to render the HTML and PDF previews.
If left blank, the locale information in the input document will be used to select a suitable table.</p>
</p:documentation></p:option><p:optionname="result"required="true"px:output="result"px:type="anyDirURI"px:media-type="text"><p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">Output file</h2><ppx:role="desc">The output braille file.</p>
</p:documentation></p:option><p:optionname="pef"required="false"px:output="result"px:type="anyDirURI"px:media-type="application/x-pef+xml"select="''"><p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">PEF</h2><ppx:role="desc">The intermediary PEF file.</p>
</p:documentation></p:option><p:optionname="preview"required="false"px:output="result"px:type="anyDirURI"px:media-type="text/html"select="''"><p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">Preview</h2><ppx:role="desc">An HTML preview of the braille result.</p>
</p:documentation></p:option><p:optionname="pdf"required="false"px:output="result"px:type="anyDirURI"px:media-type="application/pdf"select="''"><p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">PDF</h2><ppx:role="desc">A PDF version of the braille showing ASCII braille.</p>
</p:documentation></p:option><p:optionname="hyphenation-at-page-breaks"required="false"select="'false'"><p:pipeinfo><px:type>
<choicexmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">
<value>false</value>
<a:documentationxml:lang="en">Never hyphenate words at page boundaries</a:documentation>
<value>except-at-volume-breaks</value>
<a:documentationxml:lang="en">Allow hyphenation at page boundaries except when it's a volume boundary</a:documentation>
<value>true</value>
<a:documentationxml:lang="en">Allow hyphenation at page boundaries</a:documentation>
</choice>
</px:type></p:pipeinfo><p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">Hyphenation at page boundaries</h2><ppx:role="desc"xml:space="preserve">Whether hyphenation of words at page boundaries is allowed or not.
This option only determines whether hyphenation is allowed at page boundaries. The "Hyphenation"
option and the CSS determine how the hyphenation is done, when allowed.
</p>
</p:documentation></p:option><p:optionname="allow-text-overflow-trimming"px:type="boolean"required="false"select="'false'"><p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">Trimming of overflowing text</h2><ppx:role="desc"xml:space="preserve">Allow trimming of overflowing text.
By default, text that overflows its containing box will result in an error. By selecting this
option, overflowing text will be truncated and generate a warning instead whenever
possible. Notably, this will happen with text within page margins (top, right, bottom and left) that
is too long to fit the space.
</p>
</p:documentation></p:option>
<p:importhref="http://www.daisy.org/pipeline/modules/braille/pef-utils/library.xpl">
<p:documentation>
px:pef-store
</p:documentation>
</p:import>
<p:importhref="obfl-to-pef.xpl">
<p:documentation>
px:obfl-to-pef
</p:documentation>
</p:import>
<p:variablename="name"select="replace(p:base-uri(/),'^.*/([^/]*)\.[^/\.]*$','$1')"/>
<px:obfl-to-pefname="convert"px:message="Converting from OBFL to PEF"px:progress=".90">
<p:with-paramport="parameters"name="hyphenation-at-page-breaks"select="$hyphenation-at-page-breaks"/>
<p:with-paramport="parameters"name="allow-text-overflow-trimming"select="$allow-text-overflow-trimming"/>
</px:obfl-to-pef>
<px:pef-storepx:progress=".10">
<p:with-optionname="pef-href"select="if ($include-pef='true' and $pef!='') then concat($pef,'/',$name,'.pef') else ''"/>
<p:with-optionname="preview-href"select="if ($include-preview='true' and $preview!='') then concat($preview,'/',$name,'.pef.html') else ''"/>
<p:with-optionname="pdf-href"select="if ($include-pdf='true' and $pdf!='') then concat($pdf,'/',$name,'.pdf') else ''"/>
<p:with-optionname="output-dir"select="$result"/>
<p:with-optionname="name-pattern"select="concat($name,'_vol-{}')"/>
<p:with-optionname="single-volume-name"select="$name"/>
<p:with-optionname="file-format"select="concat(($output-file-format,'(format:pef)')[not(.='')][1], '(document-locale:',(//pef:meta/dc:language,'und')[1],')')"/>
<p:with-optionname="preview-table"select="if ($preview-table!='') then $preview-table else concat('(document-locale:',(//pef:meta/dc:language,'und')[1],')')"/>
</px:pef-store>
</p:declare-step>