Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
TEX := $(shell find target/xprocspec/tmp/ -name '*.tex')
PDF := $(TEX:%.tex=%.pdf)

pdf : $(PDF)

target/xprocspec/%.pdf : target/xprocspec/%.tex
cd $(dir $<) && xelatex $(notdir $<) && xelatex $(notdir $<)

.PHONY : pdf
40 changes: 36 additions & 4 deletions src/main/resources/xml/dtbook2latex_common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@
<xsl:text>\setheadfoot{\onelineskip}{1.5\onelineskip}&#10;</xsl:text>
<xsl:text>\setheaderspaces{*}{*}{0.4}&#10;</xsl:text>
<xsl:text>\checkandfixthelayout&#10;&#10;</xsl:text>

<!--
Explanation: see dtb:bridgehead matcher
-->
<xsl:if test="//dtb:bridgehead//dtb:br">
<xsl:text>\newcommand{\nocontentsline}[3]{}&#10;</xsl:text>
</xsl:if>

<!-- The trim marks should be outside the actual page so that you will not
see any lines even if you do not cut the paper absolutely precisely
Expand Down Expand Up @@ -764,10 +771,35 @@
<!-- FIXME: This will fail if we are inside a level6. I guess we should define a LaTeX
command \subsubparagraph*, give it some styling and add it to level_to_section_map
-->
<xsl:value-of select="$level_to_section_map/entry[@key=$level]"/>
<xsl:text>*{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}&#10;</xsl:text>
<xsl:choose>
<xsl:when test="not(.//dtb:br)">
<xsl:value-of select="$level_to_section_map/entry[@key=$level]"/>
<xsl:text>*{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}&#10;</xsl:text>
</xsl:when>
<xsl:otherwise>
<!--
Because chapter*, section*, etc. don't have a "short-title" argument we must use an
alternative method to disable numbering and skip the toc entry.
-->
<!-- don't number -->
<xsl:text>\setcounter{secnumdepth}{-1}&#10;</xsl:text>
<!-- don't add to toc -->
<xsl:text>\bgroup\let\addcontentsline=\nocontentsline&#10;</xsl:text>
<xsl:value-of select="$level_to_section_map/entry[@key=$level]"/>
<xsl:text>[</xsl:text>
<xsl:value-of select="normalize-space(my:quoteSpecialChars(string()))"/>
<xsl:text>]{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}&#10;</xsl:text>
<xsl:text>\egroup&#10;</xsl:text>
<!-- reset numbering depth to 1 (section) or 0 (book) -->
<xsl:text>\setcounter{secnumdepth}{</xsl:text>
<xsl:value-of select="if ($pageStyle='plain') then '0' else '1'"/>
<xsl:text>}&#10;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="dtb:list[not(@type)]">
Expand Down
170 changes: 170 additions & 0 deletions src/test/xprocspec/br_in_bridgehead.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8"?>
<c:data content-type="application/x-latex" xmlns:c="http://www.w3.org/ns/xproc-step">
% ***********************
% DMFC dtbook2latex v0.3
% ***********************
\documentclass[17pt,a4paper,extrafontsizes,twoside,showtrims,openright]{memoir}
\usepackage{calc}
\captionstyle{\raggedright}
\settrimmedsize{250mm}{200mm}{*}
\setlength{\trimtop}{\stockheight - \paperheight}
\setlength{\trimedge}{\stockwidth - \paperwidth}
\settrims{0.5\trimtop}{\trimedge}
\setlrmarginsandblock{28mm}{20mm}{*}
\setulmarginsandblock{20mm}{20mm + 1.5\onelineskip}{*}
\setheadfoot{\onelineskip}{1.5\onelineskip}
\setheaderspaces{*}{*}{0.4}
\checkandfixthelayout

\newcommand{\nocontentsline}[3]{}
\newcommand*{\trimLmarksLight}{%
\let\tmarktl\Ltrimpictl
\let\tmarktr\Ltrimpictr
\let\tmarkbl\Ltrimpicbl
\let\tmarkbr\Ltrimpicbr
\let\tmarktm\relax
\let\tmarkml\relax
\let\tmarkmr\relax
\let\tmarkbm\relax}

\trimLmarksLight

\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage[german]{babel}
\def\languageshorthands#1{}
\setlength{\parskip}{1.5ex}
\setlength{\parindent}{0ex}
\usepackage{fontspec,xunicode,xltxtra}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Tiresias LPfont}
\usepackage{hyperref}
\hypersetup{pdftitle={TESTSERVER3\_1901}, pdfauthor={}}
\usepackage{float}
\usepackage{alphalph}

\sloppy
\setlength{\topskip}{1.6\topskip}
\checkandfixthelayout
\sloppybottom

\clubpenalty=10000
\widowpenalty=10000
\raggedbottom
\renewcommand*{\chaptitlefont}{\normalfont\LARGE\bfseries\raggedright}
\setsecheadstyle{\Large\bfseries\raggedright}
\setsubsecheadstyle{\large\bfseries\raggedright}
\setsubsubsecheadstyle{\bfseries\raggedright}
\newlength{\textheightMinusCaption}
\setlength{\textheightMinusCaption}{\textheight - \baselineskip}
\renewcommand{\cftchapterleader}{, }
\renewcommand{\cftchapterafterpnum}{\cftparfillskip}
\renewcommand{\cftsectionleader}{, }
\renewcommand{\cftsectionafterpnum}{\cftparfillskip}
\renewcommand{\cftsubsectionleader}{, }
\renewcommand{\cftsubsectionafterpnum}{\cftparfillskip}
\renewcommand{\cftsubsubsectionleader}{, }
\renewcommand{\cftsubsubsectionafterpnum}{\cftparfillskip}
\makeevenfoot{plain}{\thepage}{}{}
\makeoddfoot{plain}{}{}{\thepage}
\setrmarg{3.55em plus 1fil}
\maxtocdepth{section}
\renewcommand{\foottextfont}{\normalsize}
\footmarkstyle{\textsuperscript{#1} }
\setlength{\footmarkwidth}{0ex}
\setlength{\footmarksep}{\footmarkwidth}
\setlength{\footnotesep}{\onelineskip}
\renewcommand{\footnoterule}{%
\kern-3pt%
\hrule height 1.5pt
\kern 2.6pt}
\renewcommand{\theenumii}{\AlphAlph{\value{enumii}}}
\renewcommand{\labelenumii}{\theenumii}

\OnehalfSpacing
\setlength{\cftparskip}{0.25\onelineskip}
\setlength{\vindent}{0em}
\newenvironment{indentedlist}%
{\begin{list}{}{%
\setlength{\leftmargin}{1.5em}%
\setlength{\rightmargin}{0pt}%
\setlength{\labelwidth}{0pt}%
\setlength{\itemindent}{0pt}}}%
{\end{list}}
\renewcommand*{\notesname}{Anmerkungen}
\begin{document}
\raggedright
\frontmatter
{\large Burkhard Wetekam}\\[1.5cm]
\begin{Spacing}{1.75}
{\huge Diebe im Dschungel}\\[0.5cm]
\end{Spacing}
\vfill
Grossdruck in einem Band\\[0.5cm]
SBS Schweizerische Bibliothek \\
für Blinde, Seh- und Lesebehinderte\\[0.5cm]
\clearpage
Dieses Grossdruckbuch ist die ausschliesslich für die Nutzung durch seh- und lesebehinderte Menschen bestimmte zugängliche Version eines urheberrechtlich geschützten Werks. Sie können es im Rahmen des Urheberrechts persönlich nutzen, dürfen es aber nicht weiter verbreiten oder öffentlich zugänglich machen.

\vfill
Verlag, Satz und Druck:\\[0.5cm]
SBS Schweizerische Bibliothek \\
für Blinde, Seh- und Lesebehinderte, Zürich\\[0.5cm]
www.sbs.ch\\[0.5cm]
SBS 2014
\cleartorecto
{\normalsize Burkhard Wetekam}\\[1.5cm]
\begin{Spacing}{1.75}
{\Large Diebe im Dschungel}\\[0.5cm]
\end{Spacing}
Rätselkrimi

Kurzstreckenleser

\vfill
Schroedel

\clearpage
\cleartorecto
\tableofcontents*
\mainmatter
\pagestyle{Ruled}
\aliaspagestyle{chapter}{plain}
\chapter[Chapter]{Chapter}
Text

\section[Section]{Section}
Text

\subsection[Subsection]{Subsection}
Text

\chapter*{\ }
\section*{Bridgehead}
Text

\section[Section]{Section}
Text

\subsection[Subsection]{Subsection}
Text

\setcounter{secnumdepth}{-1}
\bgroup\let\addcontentsline=\nocontentsline
\section[Bridgehead]{Bridge\\*
head}
\egroup
\setcounter{secnumdepth}{1}
Text

\section[Section]{Section}
Text

\subsection[Subsection]{Subsection}
Text

\chapter[Chapter]{Chapter}
Text

\end{document}
</c:data>
92 changes: 92 additions & 0 deletions src/test/xprocspec/br_in_bridgehead.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE dtbook [
<!ENTITY ndash "&#x2013;">
<!ENTITY nbsp "&#x00A0;">
<!ENTITY test "<brl:select><brl:when-braille>braille</brl:when-braille><brl:otherwise>other</brl:otherwise></brl:select>">
]>
<?oxygen RNGSchema="http://xmlp-test/schema/dtbook-2005-3-sbs.rng" type="xml"?><dtbook xmlns:brl="http://www.daisy.org/z3986/2009/braille/" xmlns="http://www.daisy.org/z3986/2005/dtbook/" version="2005-3-sbs-full" xml:lang="de-1901">
<head>
<meta name="dc:Title" content="TESTSERVER3_1901"/>
<meta name="dc:Creator" content=""/>
<meta name="dc:Subject" content=""/>
<meta name="dc:Description" content=""/>
<meta name="dc:Publisher" content="SBS Schweizerische Bibliothek für Blinde, Seh- und Lesebehinderte"/>
<meta name="dc:Date" content="2014-01-10"/>
<meta name="dc:Type" content="Text"/>
<meta name="dc:Format" content="ANSI/NISO Z39.86-2005"/>
<meta name="dc:Identifier" content="ch-sbs-a2e12e34-cf2c-495a-b1d8-81e0e03d930a"/>
<meta name="dc:Source" content=""/>
<meta name="dc:Language" content="de-1901"/>
<meta name="dc:Rights" content=""/>
<meta name="dtb:uid" content="ch-sbs-a2e12e34-cf2c-495a-b1d8-81e0e03d930a"/>
<meta name="dtb:sourceEdition" content=""/>
<meta name="dtb:sourcePublisher" content=""/>
<meta name="dtb:sourceRights" content=""/>
<meta name="prod:series" content=""/>
<meta name="prod:seriesNumber" content=""/>
<meta name="prod:source" content=""/>
</head>
<book>
<frontmatter>
<doctitle>Diebe im Dschungel</doctitle>
<docauthor>Burkhard Wetekam</docauthor>
<level1 class="titlepage">
<level2>
<p>Rätselkrimi</p>
<p>Kurzstreckenleser</p>
<p class="sourcePublisher">Schroedel</p>
</level2>
</level1>
<level1 class="toc">
<list>
<li>
<lic></lic>
<list>
<li><lic></lic></li>
</list>
</li>
</list>
</level1>
</frontmatter>
<bodymatter>
<level1>
<h1>Chapter</h1>
<p>Text</p>
<level2>
<h2>Section</h2>
<p>Text</p>
<level3>
<h3>Subsection</h3>
<p>Text</p>
</level3>
</level2>
</level1>
<level1>
<bridgehead>Bridgehead</bridgehead>
<p>Text</p>
<level2>
<h2>Section</h2>
<p>Text</p>
<level3>
<h3>Subsection</h3>
<p>Text</p>
</level3>
</level2>
<bridgehead>Bridge<br/>head</bridgehead>
<p>Text</p>
<level2>
<h2>Section</h2>
<p>Text</p>
<level3>
<h3>Subsection</h3>
<p>Text</p>
</level3>
</level2>
</level1>
<level1>
<h1>Chapter</h1>
<p>Text</p>
</level1>
</bodymatter>
</book>
</dtbook>
59 changes: 59 additions & 0 deletions src/test/xprocspec/test_dtbook2latex.xprocspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<x:description xmlns:x="http://www.daisy.org/ns/xprocspec"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:cx="http://xmlcalabash.com/ns/extensions"
xmlns:dtb="http://www.daisy.org/z3986/2005/dtbook/">

<x:script>
<p:pipeline type="x:test" name="main" version="1.0">
<p:option name="save-as" required="true"/>
<p:xslt name="xslt">
<p:input port="stylesheet">
<p:inline>
<xsl:stylesheet version="2.0">
<xsl:import href="../../main/resources/xml/dtbook2latex_sbs.xsl"/>
<xsl:template match="/">
<xsl:element name="c:data">
<xsl:attribute name="content-type" select="'application/x-latex'"/>
<xsl:apply-imports/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
</p:inline>
</p:input>
</p:xslt>
<p:store method="text" name="store">
<p:with-option name="href" select="$save-as"/>
</p:store>
<p:identity cx:depends-on="store">
<p:input port="source">
<p:pipe step="xslt" port="result"/>
</p:input>
</p:identity>
</p:pipeline>
</x:script>

<x:scenario label="br_in_bridgehead">
<x:call step="x:test">
<x:input port="source">
<x:document type="file" href="br_in_bridgehead.xml"/>
</x:input>
<x:param name="font" select="'Tiresias LPfont'"/>
<x:param name="fontsize" select="'17pt'"/>
<x:param name="pageStyle" select="scientific"/>
<x:param name="alignment" select="'left'"/>
<x:param name="line_spacing" select="'onehalfspacing'"/>
<x:param name="replace_em_with_quote" select="'true'"/>
<x:option name="save-as" select="resolve-uri('br_in_bridgehead.tex',$temp-dir)"/>
</x:call>
<x:context label="result">
<x:document type="port" port="result"/>
</x:context>
<x:expect label="result" type="compare">
<x:document type="file" href="br_in_bridgehead.tex"/>
</x:expect>
</x:scenario>

</x:description>