-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run test for emphasis indicators in Norwegian
see issue #6
- Loading branch information
Showing
8 changed files
with
276 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ces/translation/Test.DTBook.Norwegian transl.Uncontracted braille.Emphasis indicators.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@page { size: 32 28; } | ||
|
||
pagenum { display: none } | ||
|
||
h1 { | ||
display: block; | ||
margin-left: 2; | ||
text-indent: 5; | ||
border-bottom: ⠉; | ||
margin-bottom: 1; | ||
} | ||
|
||
p { | ||
display: block; | ||
margin-left: 2; | ||
text-indent: 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<x:description xmlns:x="http://www.daisy.org/ns/xprocspec" | ||
xmlns:pxi="http://www.daisy.org/ns/pipeline/xproc/internal" | ||
xmlns: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:dotify="http://code.google.com/p/dotify/" | ||
xmlns:css="http://www.daisy.org/ns/pipeline/braille-css"> | ||
|
||
<x:script> | ||
<p:declare-step type="pxi:translate" version="1.0"> | ||
<p:input port="source"/> | ||
<p:output port="result"/> | ||
<p:option name="stylesheet" required="true"/> | ||
<p:import href="http://www.daisy.org/pipeline/modules/braille/dotify-formatter/library.xpl"/> | ||
<p:import href="http://www.daisy.org/pipeline/modules/braille/css-calabash/library.xpl"/> | ||
<p:import href="http://www.daisy.org/pipeline/modules/braille/common-utils/library.xpl"/> | ||
<css:inline> | ||
<p:with-option name="default-stylesheet" select="resolve-uri($stylesheet)"/> | ||
</css:inline> | ||
<px:transform type="css-block" query=""/> | ||
<dotify:format/> | ||
</p:declare-step> | ||
</x:script> | ||
|
||
<x:scenario id="38.1" label="Text marked up with <strong> and <em> should get braille indicators in Norwegian uncontracted"> | ||
<x:call step="pxi:translate"> | ||
<x:input port="source"> | ||
<x:document type="file" href="../../resources/translation/Test.DTBook.Norwegian transl.Uncontracted braille.Emphasis indicators.xml"/> | ||
</x:input> | ||
<x:option name="stylesheet" select="'style.css'"/> | ||
</x:call> | ||
<x:context label="result"> | ||
<x:document type="port" port="result"/> | ||
</x:context> | ||
<x:expect label="result" type="custom" href="http://www.daisy.org/pipeline/modules/braille/pef-utils/library.xpl" step="x:pef-compare"> | ||
<x:document type="file" href="../../resources/translation/Test.PEF.Norwegian transl.Uncontracted braille.Emphasis indicators.pef"/> | ||
</x:expect> | ||
</x:scenario> | ||
|
||
</x:description> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
<?xml version="1.0" encoding="utf-8" standalone="yes"?> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
xmlns:x="http://www.daisy.org/ns/xprocspec" | ||
xmlns:pef="http://www.daisy.org/ns/2008/pef" | ||
xmlns:html="http://www.w3.org/1999/xhtml" | ||
xmlns="http://www.w3.org/1999/xhtml" | ||
exclude-result-prefixes="#all" | ||
version="2.0"> | ||
|
||
<xsl:include href="../common/serialize.xsl"/> | ||
<xsl:include href="http://www.daisy.org/pipeline/modules/braille/pef-utils/library.xsl"/> | ||
|
||
<xsl:template match="@*|node()"> | ||
<xsl:copy> | ||
<xsl:apply-templates select="@*|node()"/> | ||
</xsl:copy> | ||
</xsl:template> | ||
|
||
<xsl:template match="x:description"> | ||
<xsl:copy> | ||
<xsl:apply-templates select="@*"/> | ||
<link rel="stylesheet" type="text/css" href="../../style.css"/> | ||
<link rel="stylesheet" href="../../github.min.css"/> | ||
<script type="text/javascript" src="../../jquery.min.js"/> | ||
<script type="text/javascript" src="../../highlight.min.js"/> | ||
<script type="text/javascript"> | ||
$(document).ready(function() { | ||
$("code").each(function(i, block) { | ||
hljs.highlightBlock(block); | ||
}); | ||
$(".document.pef").each(function(i, div) { | ||
var x = ["pef-xml", "pef-ascii", "pef-unicode"]; | ||
x.forEach(function(clazz) { | ||
$(div).children("a." + clazz).click((function(clazz) { | ||
return function(e) { | ||
e.preventDefault(); | ||
$(div).removeClass("pef-xml pef-ascii pef-unicode"); | ||
$(div).addClass(clazz); | ||
} | ||
})(clazz)); | ||
}); | ||
}); | ||
}); | ||
</script> | ||
<xsl:apply-templates select="node()"/> | ||
</xsl:copy> | ||
</xsl:template> | ||
|
||
<xsl:template match="x:scenario"> | ||
<xsl:copy> | ||
<xsl:apply-templates select="@*"/> | ||
<xsl:if test="not(child::x:documentation)"> | ||
<x:documentation> | ||
<xsl:variable name="ul"> | ||
<wrap xml:base="{base-uri(.)}"> | ||
<ul> | ||
<xsl:variable name="source" select="x:call/x:input[@port='source']/x:document"/> | ||
<xsl:if test="$source"> | ||
<li> | ||
<xsl:call-template name="x:document-as-code"> | ||
<xsl:with-param name="x:document" select="$source"/> | ||
<xsl:with-param name="with-title">source</xsl:with-param> | ||
</xsl:call-template> | ||
</li> | ||
</xsl:if> | ||
<xsl:if test="x:call/x:option[@name='stylesheet']"> | ||
<li> | ||
<a class="code" href="{replace(x:call/x:option[@name='stylesheet']/@select, '^.(.*).$', '$1')}">stylesheet</a> | ||
</li> | ||
</xsl:if> | ||
<xsl:variable name="result" select="x:expect[preceding-sibling::x:context[1]/x:document[@port='result']]/x:document"/> | ||
<xsl:if test="$result"> | ||
<li> | ||
<xsl:call-template name="x:document-as-code"> | ||
<xsl:with-param name="x:document" select="$result"/> | ||
<xsl:with-param name="with-title">result</xsl:with-param> | ||
<xsl:with-param name="with-class" select="if ($result/parent::*/@step='x:pef-compare') then 'pef' else ''"/> | ||
</xsl:call-template> | ||
</li> | ||
</xsl:if> | ||
</ul> | ||
</wrap> | ||
</xsl:variable> | ||
<xsl:apply-templates select="$ul/*/html:ul"/> | ||
</x:documentation> | ||
</xsl:if> | ||
<xsl:apply-templates select="node()"/> | ||
</xsl:copy> | ||
</xsl:template> | ||
|
||
<xsl:template name="x:document-as-code"> | ||
<xsl:param name="x:document"/> | ||
<xsl:param name="with-title"/> | ||
<xsl:param name="with-class"/> | ||
<xsl:choose> | ||
<xsl:when test="$x:document/@type='file'"> | ||
<a href="{$x:document/@href}" class="{string-join(('code', $with-class), ' ')}"> | ||
<xsl:sequence select="$with-title"/> | ||
</a> | ||
</xsl:when> | ||
<xsl:when test="$x:document/@type='inline'"> | ||
<span> | ||
<xsl:sequence select="$with-title"/> | ||
<div class="{string-join(('document', $with-class), ' ')}"> | ||
<code> | ||
<xsl:if test="$with-class"> | ||
<xsl:attribute name="class" select="$with-class"/> | ||
</xsl:if> | ||
<xsl:apply-templates select="$x:document/*" mode="serialize"/> | ||
</code> | ||
<xsl:if test="tokenize($with-class, '\s+')='pef'"> | ||
<xsl:sequence select="$x:document/pef:pef"/> | ||
<a class="pef-xml" href="#">xml</a> | ||
<a class="pef-unicode" href="#">unicode</a> | ||
<a class="pef-ascii" href="#">ascii</a> | ||
</xsl:if> | ||
</div> | ||
</span> | ||
</xsl:when> | ||
</xsl:choose> | ||
</xsl:template> | ||
|
||
<xsl:template match="html:a[tokenize(@class, '\s+')='code']"> | ||
<span> | ||
<xsl:copy> | ||
<xsl:apply-templates select="@*|node()"/> | ||
</xsl:copy> | ||
<xsl:variable name="class" select="string-join(tokenize(@class, '\s+')[not('code'=.)], ' ')"/> | ||
<div class="{string-join(('document', $class), ' ')}"> | ||
<code> | ||
<xsl:if test="$class!=''"> | ||
<xsl:attribute name="class" select="$class"/> | ||
</xsl:if> | ||
<xsl:value-of select="unparsed-text(resolve-uri(@href, base-uri(/*)))"/> | ||
</code> | ||
<xsl:if test="tokenize($class, '\s+')='pef'"> | ||
<xsl:apply-templates select="document(resolve-uri(@href, base-uri(/*)))/pef:pef"/> | ||
<a class="pef-xml" href="#">xml</a> | ||
<a class="pef-unicode" href="#">unicode</a> | ||
<a class="pef-ascii" href="#">ascii</a> | ||
</xsl:if> | ||
</div> | ||
</span> | ||
</xsl:template> | ||
|
||
<xsl:template match="pef:page"> | ||
<xsl:variable name="rows" select="xs:integer(number(ancestor::*[@rows][1]/@rows))"/> | ||
<xsl:variable name="cols" select="xs:integer(number(ancestor::*[@cols][1]/@cols))"/> | ||
<!-- | ||
TODO: which encoding is used in Norway? | ||
--> | ||
<xsl:variable name="table" select="'org.daisy.braille.table.DefaultTableProvider.TableType.EN_US'"/> | ||
<xsl:copy> | ||
<xsl:sequence select="@*"/> | ||
<xsl:for-each select="pef:row"> | ||
<xsl:variable name="row" select="string-join((string(.), for $x in string-length(string(.)) + 1 to $cols return '⠀'), '')"/> | ||
<pef:row> | ||
<xsl:sequence select="$row"/> | ||
</pef:row> | ||
<pef:row class="ascii"> | ||
<xsl:sequence select="pef:encode($table, $row)"/> | ||
</pef:row> | ||
</xsl:for-each> | ||
<xsl:for-each select="count(pef:row) + 1 to $rows"> | ||
<xsl:variable name="row" select="string-join(for $x in 1 to $cols return '⠀', '')"/> | ||
<pef:row> | ||
<xsl:sequence select="$row"/> | ||
</pef:row> | ||
<pef:row class="ascii"> | ||
<xsl:sequence select="pef:encode($table, $row)"/> | ||
</pef:row> | ||
</xsl:for-each> | ||
</xsl:copy> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |