Skip to content

Commit

Permalink
Fix PEF preview: link to CSS and Javascript files instead of embedding
Browse files Browse the repository at this point in the history
because the embedded way broke with the addition of '<' and '>'
characters. Non of the following solutions work:

* Wrapping the JS/CSS in <!-- --> tags worked locally but not in the web
  UI
* I can wrap the JS/CSS in CDATA tags and disable the escaping of the
  JS/CSS using cdata-section-elements="html:script" on p:store, but I
  need // <![CDATA[ and /* <![CDATA[ */
* Inserting the CDATA tags and disabling the escaping of the JS/CSS
  could in theory be done with disable-output-escaping="yes" on xsl:text
  and xsl:value-of select="unparsed-text(...)", but it does not work.
  • Loading branch information
bertfrees committed Jun 21, 2016
1 parent 19a511b commit c81f70a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,8 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
<xsl:comment>
<xsl:value-of select="unparsed-text('pef-preview.css', 'utf-8')"/>
</xsl:comment>
</style>
<script type="text/javascript">
<xsl:comment> <!-- be careful with "minus-minus" in JS -->
<xsl:value-of select="unparsed-text('pef-preview.js', 'utf-8')"/>
</xsl:comment>
</script>
<link rel="stylesheet" type="text/css" href="pef-preview.css"/>
<script type="text/javascript" href="pef-preview.js"/>
</head>
<body>
<div id="header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@
omit-xml-declaration="false"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
cdata-section-elements="html:script"
-->
<p:with-option name="href" select="$preview-href"/>
</p:store>
<!--
Expand All @@ -152,6 +149,14 @@
<p:with-option name="href" select="resolve-uri('../odt2braille8.ttf')"/>
<p:with-option name="target" select="resolve-uri('odt2braille8.ttf', $preview-href)"/>
</px:copy-resource>
<px:copy-resource fail-on-error="true" cx:depends-on="mkdir">
<p:with-option name="href" select="resolve-uri('pef-preview.css')"/>
<p:with-option name="target" select="resolve-uri('pef-preview.css', $preview-href)"/>
</px:copy-resource>
<px:copy-resource fail-on-error="true" cx:depends-on="mkdir">
<p:with-option name="href" select="resolve-uri('pef-preview.js')"/>
<p:with-option name="target" select="resolve-uri('pef-preview.js', $preview-href)"/>
</px:copy-resource>
<p:sink/>
</p:when>
<p:otherwise>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
<x:document type="directory" base-uri="temp-dir" href="test_01/" recursive="true"/>
</x:context>
<x:expect type="count" label="The output directory should exist" min="1" max="1"/>
<x:expect type="xpath" label="The number of files stored should be 3" test="count(//c:file)=3"/>
<x:expect type="xpath" label="The number of files stored should be 5" test="count(//c:file)=5"/>
<x:expect type="xpath" label="The file pef_4.pef should be stored" test="/*/c:file[@name='pef_4.pef']"/>
<x:expect type="xpath" label="The file pef_4.pef.html should be stored" test="/*/c:file[@name='pef_4.pef.html']"/>
<x:expect type="xpath" label="The file odt2braille8.ttf should be stored" test="/*/c:file[@name='odt2braille8.ttf']"/>
<x:expect type="xpath" label="The file pef-preview.css should be stored" test="/*/c:file[@name='pef-preview.css']"/>
<x:expect type="xpath" label="The file pef-preview.js should be stored" test="/*/c:file[@name='pef-preview.js']"/>
</x:scenario>

<x:scenario label="test_02">
Expand Down

0 comments on commit c81f70a

Please sign in to comment.