Update for DAISY integration ahead of 1.2.0.7.
This commit is contained in:
parent
08641acec4
commit
635f783128
|
@ -10,25 +10,39 @@ bool PlayListRenamer::run (
|
|||
{
|
||||
std::string m3uFile, m3uBuffer;
|
||||
m3uFile = folder + "playlist.m3u";
|
||||
|
||||
if ( !readFile ( m3uFile, m3uBuffer ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::string> lines;
|
||||
if ( !splitBuffer ( m3uBuffer, lines ) )
|
||||
{
|
||||
wxMessageBox ( _T("can't split buffer") );
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string title, from, to;
|
||||
size_t lineCount = lines.size();
|
||||
int trackNo = 0;
|
||||
|
||||
wxString random;
|
||||
random.Printf ( _T("%i"), lineCount );
|
||||
wxMessageBox (random );
|
||||
for ( size_t i = 0; i < lineCount; i++ )
|
||||
{
|
||||
wxString line;
|
||||
line = wxString ( lines[i].c_str(), wxConvUTF8, lines[i].size() );
|
||||
wxMessageBox ( line );
|
||||
|
||||
if ( lines[i][0] == '#' )
|
||||
{
|
||||
if ( !lines[i].find ( "EXTINF" ) )
|
||||
if ( lines[i].find ( "EXTINF" ) == std::string::npos )
|
||||
continue;
|
||||
|
||||
//isolate m3u trackname
|
||||
std::string pattern0 = ".*?,";
|
||||
std::string pattern0 = ".+?,";
|
||||
WrapRegex re0 ( pattern0, true );
|
||||
int replacements;
|
||||
title = re0.replaceGlobal ( lines[i], &replacements );
|
||||
|
@ -66,6 +80,10 @@ bool PlayListRenamer::run (
|
|||
from = lines[i];
|
||||
to = title;
|
||||
|
||||
wxString wideFrom, wideTo;
|
||||
wideFrom = wxString ( from.c_str(), wxConvUTF8, from.size() );
|
||||
wideTo = wxString ( to.c_str(), wxConvUTF8, to.size() );
|
||||
|
||||
renameFile ( from, to, folder );
|
||||
editFiles ( from, to, folder );
|
||||
|
||||
|
@ -88,8 +106,9 @@ bool PlayListRenamer::readFile ( const std::string& path, std::string& buffer )
|
|||
return true;
|
||||
}
|
||||
|
||||
bool PlayListRenamer::splitBuffer ( const std::string& buffer, std::vector<std::string> lineVector )
|
||||
bool PlayListRenamer::splitBuffer ( const std::string& buffer, std::vector<std::string>& lineVector )
|
||||
{
|
||||
wxMessageBox ( wxString ( buffer.c_str(), wxConvUTF8, buffer.size() ) );
|
||||
std::string line;
|
||||
lineVector.clear();
|
||||
size_t bufferSize = buffer.size();
|
||||
|
@ -134,7 +153,8 @@ void PlayListRenamer::renameFile ( const std::string& from, const std::string& t
|
|||
wideFolder = wxString ( folder.c_str(), wxConvUTF8, folder.size() );
|
||||
wideFrom = wxString ( from.c_str(), wxConvUTF8, from.size() );
|
||||
wideTo = wxString ( to.c_str(), wxConvUTF8, to.size() );
|
||||
wxRenameFile ( wideFolder + wideFrom, wideFolder + wideTo );
|
||||
wxMessageBox ( wideFolder + wideFrom, wideFolder + wideTo );
|
||||
//wxRenameFile ( wideFolder + wideFrom, wideFolder + wideTo );
|
||||
}
|
||||
|
||||
void PlayListRenamer::editFiles ( const std::string& from, const std::string& to, const std::string& folder )
|
||||
|
|
|
@ -12,7 +12,7 @@ public:
|
|||
bool run ( const std::string& folder );
|
||||
private:
|
||||
bool readFile ( const std::string& path, std::string& buffer );
|
||||
bool splitBuffer ( const std::string& buffer, std::vector<std::string> lineVector );
|
||||
bool splitBuffer ( const std::string& buffer, std::vector<std::string>& lineVector );
|
||||
void renameFile ( const std::string& from, const std::string& to, const std::string& folder );
|
||||
void editFiles ( const std::string& from, const std::string& to, const std::string& folder );
|
||||
std::string numToString ( int i );
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
#include "xmlcopyimg.h"
|
||||
#include "binaryfile.h"
|
||||
#include "replace.h"
|
||||
#include "wrapregex.h"
|
||||
#include "mp3album.h"
|
||||
//#include "playlistrenamer.h"
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include <wx/msw/ole/automtn.h>
|
||||
|
@ -195,6 +197,19 @@ bool WrapDaisy::run (
|
|||
// prevent MIME type errors in href="www..." attributes
|
||||
Replace::run ( output, "href=\"www", "href=\"http://www", true );
|
||||
|
||||
// remove em-space
|
||||
Replace::run ( output, "\xE2\x80\x83", " ", true );
|
||||
|
||||
// remove blank paragraphs
|
||||
Replace::run ( output, "<p></p>", "", true );
|
||||
|
||||
int replaceCount;
|
||||
WrapRegex regexParaWhitespace ( "<p>\\w+</p>", true );
|
||||
output = regexParaWhitespace.replaceGlobal ( output, &replaceCount );
|
||||
|
||||
WrapRegex regexContiguousWhitespace ( "[\\t ]+", true, " " );
|
||||
output = regexContiguousWhitespace.replaceGlobal ( output, &replaceCount );
|
||||
|
||||
// copy images
|
||||
wxString htmlDir, imagesDir, mediaDir;
|
||||
htmlDir = folder + wxFileName::GetPathSeparator() + _T("html");
|
||||
|
@ -245,7 +260,7 @@ bool WrapDaisy::run (
|
|||
while (wxTheApp->Pending())
|
||||
wxTheApp->Dispatch();
|
||||
|
||||
if ( !pd->Update ( 25, _("Copying images and audio files...") ) )
|
||||
if ( !pd->Update ( 25, _("Copying files...") ) )
|
||||
{
|
||||
error = _ ( "Cancelled" );
|
||||
return false;
|
||||
|
@ -299,7 +314,7 @@ bool WrapDaisy::run (
|
|||
wxString cmd = baseCmd +
|
||||
xhtml2dtbookScript +
|
||||
_T(" --inputFile=\"") +
|
||||
canonicalFile + //canonicalFile.wideName() +
|
||||
canonicalFile +
|
||||
_T("\" --outputFile=\"") +
|
||||
dtbFilePath + _T("\"");
|
||||
|
||||
|
@ -328,7 +343,7 @@ bool WrapDaisy::run (
|
|||
if ( !error.empty() )
|
||||
return false;
|
||||
|
||||
// #2.5: create EPUB version
|
||||
// #2.5: create ePub version
|
||||
pd->ProcessPendingEvents();
|
||||
while (wxTheApp->Pending())
|
||||
wxTheApp->Dispatch();
|
||||
|
@ -403,7 +418,15 @@ bool WrapDaisy::run (
|
|||
rtfScript += wxFileName::GetPathSeparator();
|
||||
rtfScript += _T("DtbookToRtf.taskScript");
|
||||
|
||||
wxString rtfFile = folder + wxFileName::GetPathSeparator() + _T("document.rtf");
|
||||
wxString rtfFile, tempRtfFile, docFile, tempDocFile;
|
||||
rtfFile = folder + wxFileName::GetPathSeparator() + _T("document.rtf");
|
||||
tempRtfFile = folder + wxFileName::GetPathSeparator() + _T("html") +
|
||||
wxFileName::GetPathSeparator() + _T("document.rtf");
|
||||
|
||||
docFile = rtfFile;
|
||||
tempDocFile = tempRtfFile;
|
||||
docFile.Replace ( _T(".rtf"), _T(".doc") );
|
||||
tempDocFile.Replace ( _T(".rtf"), _T(".doc") );
|
||||
|
||||
cmd = baseCmd +
|
||||
_T("\"") + rtfScript + _T("\" --input=\"") +
|
||||
|
@ -451,9 +474,8 @@ bool WrapDaisy::run (
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
wxString docFile = rtfFile;
|
||||
docFile.Replace ( _T(".rtf"), _T(".doc") );
|
||||
//wxString docFile = rtfFile;
|
||||
//docFile.Replace ( _T(".rtf"), _T(".doc") );
|
||||
|
||||
#ifdef __WXMSW__
|
||||
wxAutomationObject wordObject, documentObject;
|
||||
|
@ -461,17 +483,17 @@ bool WrapDaisy::run (
|
|||
if ( wordObject.CreateInstance ( _T("Word.Application") ) )
|
||||
{
|
||||
wxVariant openParams[2];
|
||||
openParams[0] = rtfFile;
|
||||
openParams[0] = rtfFile;//tempRtfFile
|
||||
openParams[1] = false;
|
||||
|
||||
wordObject.CallMethod(_("documents.open"), 2, openParams);
|
||||
if (!wordObject.GetObject(documentObject, _("ActiveDocument")))
|
||||
{
|
||||
error = _("Cannot open ") + rtfFile;
|
||||
error = _("Cannot open ") + rtfFile;//tempRtfFile;
|
||||
return false;
|
||||
}
|
||||
wxVariant saveAsParams[2];
|
||||
saveAsParams[0] = docFile;
|
||||
saveAsParams[0] = docFile;//tempDocFile;//
|
||||
saveAsParams[1] = (long)0; //wdFormatDocument
|
||||
if ( !documentObject.CallMethod(_("SaveAs"), 2, saveAsParams) )
|
||||
{
|
||||
|
@ -482,9 +504,15 @@ bool WrapDaisy::run (
|
|||
wordObject.CallMethod(_T("Quit"), 0, NULL );
|
||||
}
|
||||
#else
|
||||
//wxCopyFile ( tempRtfFile, tempDocFile );
|
||||
wxCopyFile ( rtfFile, docFile );
|
||||
#endif
|
||||
|
||||
//wxCopyFile ( tempRtfFile, rtfFile );
|
||||
//wxCopyFile ( tempDocFile, docFile );
|
||||
//wxRemoveFile ( tempRtfFile );
|
||||
//wxRemoveFile ( tempDocFile );
|
||||
|
||||
// #3: convert to full DAISY book
|
||||
pd->ProcessPendingEvents();
|
||||
while (wxTheApp->Pending())
|
||||
|
@ -629,8 +657,9 @@ bool WrapDaisy::run (
|
|||
return false;
|
||||
}
|
||||
|
||||
//rename mp3 playlists
|
||||
/*
|
||||
//rename mp3 playlists
|
||||
albumDir += wxFileName::GetPathSeparator();
|
||||
PlayListRenamer plr;
|
||||
std::string stdAlbumDir = ( const char *) albumDir.mb_str ( wxConvUTF8 );
|
||||
plr.run ( stdAlbumDir );
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
"License along with this program; if not, write to the Free\n"\
|
||||
"Software Foundation, Inc., 59 Temple Place, Suite 330,\n"\
|
||||
"Boston, MA 02111-1307 USA.")
|
||||
#define ABOUT_VERSION _T("1.2.0.6")
|
||||
#define ABOUT_VERSION _T("1.2.0.7")
|
||||
#define XMLCE_VAR _T("XMLCE_VAR")
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
|
|
@ -135,7 +135,7 @@ void XMLCALL XmlCopyImg::start ( void *data,
|
|||
{
|
||||
wxString cmd;
|
||||
cmd += IMAGEMAGICK_CONVERT_PATH;
|
||||
cmd += _T(" -resize 720x1440>");
|
||||
cmd += _T(" -resize 720x720>");
|
||||
cmd += _T(" \"");
|
||||
cmd += wideFile;
|
||||
cmd += _T("\" \"");
|
||||
|
|
|
@ -36,60 +36,107 @@
|
|||
<xsl:variable name="caps" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
||||
<xsl:value-of select="translate(text(), $small, $caps)"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="SideNote">
|
||||
<br/>
|
||||
<hr/>
|
||||
<span class="required-prodnote">Side note</span>
|
||||
<br/>
|
||||
<xsl:apply-templates/>
|
||||
<span class="optional-prodnote">End of side note</span>
|
||||
<hr/>
|
||||
<br/>
|
||||
</xsl:template>
|
||||
<xsl:template match="SideNote/Heading">
|
||||
<br/>
|
||||
<em>
|
||||
<xsl:apply-templates/>
|
||||
</em>
|
||||
</xsl:template>
|
||||
<xsl:template match="SideNoteParagraph">
|
||||
<br/>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
<xsl:template match="Footnote">
|
||||
<br/>
|
||||
<hr/>
|
||||
<span class="required-prodnote">Footnote</span>
|
||||
<br/>
|
||||
<xsl:apply-templates/>
|
||||
<br/>
|
||||
<hr/>
|
||||
<span class="optional-prodnote">End of footnote</span>
|
||||
<br/>
|
||||
</xsl:template>
|
||||
<xsl:template match="InlineEquation">
|
||||
<br/>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(./Image/@src) > 0">
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="./Image/@src"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="alt">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(Description) > 0">
|
||||
<xsl:value-of select="Description"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length(./Image/@alt) > 0">
|
||||
<xsl:value-of select="./Image/@alt"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length(Alternative) > 0">
|
||||
<xsl:value-of select="Alternative"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length(TeX) > 0">
|
||||
<xsl:value-of select="TeX"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>no alternative text</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates select="./Image/text() | ./Image/* "/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template match="InlineEquation/Image">
|
||||
<xsl:template
|
||||
match="InlineEquation/Description | InlineEquation/Alternative | InlineEquation/TeX | InlineEquation/MathML"/>
|
||||
<xsl:template match="InlineFigure">
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="./Image/@src"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="alt">
|
||||
<xsl:value-of select="./Image/@alt"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(Description) > 0">
|
||||
<xsl:value-of select="Description"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length(./Image/@alt) > 0">
|
||||
<xsl:value-of select="./Image/@alt"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length(Alternative) > 0">
|
||||
<xsl:value-of select="Alternative"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>no alternative text</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
</xsl:template>
|
||||
<xsl:template match="InlineEquation/Description">
|
||||
<value-of select="text()"/>
|
||||
<br/>
|
||||
<xsl:template match="InlineFigure/Description | InlineFigure/Alternative"/>
|
||||
|
||||
|
||||
<xsl:template match="InlineChemistry">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(./Image/@src) > 0">
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="./Image/@src"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="alt">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(Description) > 0">
|
||||
<xsl:value-of select="Description"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length(./Image/@alt) > 0">
|
||||
<xsl:value-of select="./Image/@alt"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length(Alternative) > 0">
|
||||
<xsl:value-of select="Alternative"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>no alternative text</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates select="./Image/text() | ./Image/* "/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template match="InlineEquation/Alternative">
|
||||
<value-of select="text()"/>
|
||||
<br/>
|
||||
</xsl:template>
|
||||
<xsl:template match="InlineEquation/TeX | InlineEquation/MathML"/>
|
||||
<xsl:template
|
||||
match="InlineChemistry/Description | InlineChemistry/Alternative"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<xsl:template match="AuthorComment">
|
||||
<!-- omit -->
|
||||
<xsl:apply-templates/>
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<xsl:template name="apply-templates-lang">
|
||||
<xsl:param name="filter-sidenotes" select="'true'"/>
|
||||
<xsl:for-each select="@xml:lang">
|
||||
<xsl:if test="string-length(.) > 0">
|
||||
<xsl:copy/>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$filter-sidenotes = 'true'">
|
||||
<xsl:apply-templates select="node()[not(self::SideNote)]"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template match="language">
|
||||
<xsl:if test="string-length(@val) > 0">
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
<xsl:template match="GlossaryItem">
|
||||
<xsl:call-template name="apply-templates-lang"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="GlossaryItem/Term"><p><em><xsl:call-template name="apply-templates-lang"/></em></p>
|
||||
</xsl:template>
|
||||
<xsl:template match="GlossaryItem/Term"><p><em><xsl:call-template name="apply-templates-lang"
|
||||
/></em></p> </xsl:template>
|
||||
<xsl:template match="GlossaryItem/Definition">
|
||||
<p>
|
||||
<xsl:call-template name="apply-templates-lang"/>
|
||||
|
@ -105,24 +105,26 @@
|
|||
</p>
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(./Image/@src) > 0">
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="./Image/@src"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="alt">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(./Image/@alt) > 0">
|
||||
<xsl:value-of select="./Image/@alt"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length(Alternative) > 0">
|
||||
<xsl:value-of select="Alternative"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>no alternative text</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
<p>
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="./Image/@src"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="alt">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(./Image/@alt) > 0">
|
||||
<xsl:value-of select="./Image/@alt"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length(Alternative) > 0">
|
||||
<xsl:value-of select="Alternative"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>no alternative text</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
</p>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<p>
|
||||
|
@ -143,24 +145,26 @@
|
|||
</p>
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(./Image/@src) > 0">
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="./Image/@src"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="alt">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(./Image/@alt) > 0">
|
||||
<xsl:value-of select="./Image/@alt"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length(Alternative) > 0">
|
||||
<xsl:value-of select="Alternative"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>no alternative text</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
<p>
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="./Image/@src"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="alt">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(./Image/@alt) > 0">
|
||||
<xsl:value-of select="./Image/@alt"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length(Alternative) > 0">
|
||||
<xsl:value-of select="Alternative"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>no alternative text</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
</p>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<p>
|
||||
|
@ -396,4 +400,17 @@
|
|||
<span class="optional-prodnote">End of summary</span>
|
||||
</p>
|
||||
</xsl:template>
|
||||
<xsl:template match="SideNote">
|
||||
<hr/>
|
||||
<span class="optional-prodnote">Side note</span>
|
||||
<xsl:apply-templates/>
|
||||
<span class="optional-prodnote">End of side note</span>
|
||||
<hr/>
|
||||
</xsl:template>
|
||||
<xsl:template match="footnote">
|
||||
<sup>
|
||||
<xsl:value-of select="count(preceding::footnote) + 1"/>
|
||||
</sup>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<xsl:template match="Paragraph">
|
||||
<xsl:call-template name="handle-sidenotes"/>
|
||||
<p>
|
||||
<xsl:call-template name="apply-templates-lang"/>
|
||||
</p>
|
||||
<xsl:call-template name="handle-footnotes"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="Unit">
|
||||
<xsl:call-template name="apply-templates-lang"/>
|
||||
|
@ -16,6 +18,11 @@
|
|||
</h1>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template match="SideNoteParagraph">
|
||||
<p>
|
||||
<xsl:call-template name="apply-templates-lang"/>
|
||||
</p>
|
||||
</xsl:template>
|
||||
<xsl:template match="Unit/ByLine">
|
||||
<p>
|
||||
<xsl:call-template name="apply-templates-lang"/>
|
||||
|
@ -126,25 +133,52 @@
|
|||
<xsl:call-template name="apply-templates-lang"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="MediaContent">
|
||||
<xsl:if test="@type = 'audio'">
|
||||
<p>
|
||||
<span class="required-prodnote">[Audio content]</span>
|
||||
</p>
|
||||
<p>
|
||||
<a><xsl:attribute name="href"><xsl:value-of select="@src"/>.mp3</xsl:attribute>MP3 file
|
||||
</a>
|
||||
</p>
|
||||
</xsl:if>
|
||||
<xsl:if test="@type = 'pdf'">
|
||||
<p>
|
||||
<span class="required-prodnote">[PDF content]</span>
|
||||
</p>
|
||||
<!--<p><a><xsl:attribute name="href"><xsl:value-of select="@src"/>.pdf</xsl:attribute></a></p>-->
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@type = 'audio'">
|
||||
<p>
|
||||
<span class="required-prodnote">Audio content</span>
|
||||
</p>
|
||||
<p>
|
||||
<a><xsl:attribute name="href"><xsl:value-of select="@src"/>.mp3</xsl:attribute>MP3 file
|
||||
</a>
|
||||
</p>
|
||||
</xsl:when>
|
||||
<xsl:when test="@type = 'java'">
|
||||
<p>
|
||||
<span class="required-prodnote">Java content</span>
|
||||
</p>
|
||||
<p>
|
||||
<a><xsl:attribute name="href"><xsl:value-of select="@src"/>.jar</xsl:attribute>Java
|
||||
file</a>
|
||||
</p>
|
||||
</xsl:when>
|
||||
<xsl:when test="@type = 'flash'">
|
||||
<p>
|
||||
<span class="required-prodnote">Flash content</span>
|
||||
</p>
|
||||
<p>
|
||||
<a><xsl:attribute name="href"><xsl:value-of select="@src"/>.swf</xsl:attribute>Flash file
|
||||
</a>
|
||||
</p>
|
||||
</xsl:when>
|
||||
<xsl:when test="@type = 'video' or @type = 'videolow'">
|
||||
<p>
|
||||
<span class="required-prodnote">Movie content</span>
|
||||
</p>
|
||||
<p>
|
||||
<a><xsl:attribute name="href"><xsl:value-of select="@src"/>.mp4</xsl:attribute>Flash file
|
||||
</a>
|
||||
</p>
|
||||
</xsl:when>
|
||||
<xsl:when test="@type = 'pdf'">
|
||||
<p>
|
||||
<span class="required-prodnote">PDF content</span>
|
||||
</p>
|
||||
<!-- not possible in DAISY or ePub ATM -->
|
||||
<!--<p><a><xsl:attribute name="href"><xsl:value-of select="@src"/>.pdf</xsl:attribute></a></p>-->
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:call-template name="apply-templates-lang"/>
|
||||
<p>
|
||||
<span class="optional-prodnote">End of <xsl:value-of select="@type"/> content</span>
|
||||
</p>
|
||||
</xsl:template>
|
||||
<xsl:template match="a">
|
||||
<a href="{@href}">
|
||||
|
@ -156,7 +190,8 @@
|
|||
<xsl:call-template name="apply-templates-lang"/>
|
||||
</ol>
|
||||
</xsl:template>
|
||||
<xsl:template match="BulletedList | UnNumberedList | BulletedSubsidiaryList | UnNumberedSubsidiaryList">
|
||||
<xsl:template
|
||||
match="BulletedList | UnNumberedList | BulletedSubsidiaryList | UnNumberedSubsidiaryList">
|
||||
<ul>
|
||||
<xsl:call-template name="apply-templates-lang"/>
|
||||
</ul>
|
||||
|
@ -176,18 +211,18 @@
|
|||
<xsl:template match="Alternative">
|
||||
<p>
|
||||
<xsl:if test="string-length(.) > 0">
|
||||
<span class="optional-prodnote"><strong>Alternative</strong>: </span>
|
||||
<span class="optional-prodnote"><strong>Alternative text</strong>: </span>
|
||||
</xsl:if>
|
||||
<xsl:call-template name="apply-templates-lang"/>
|
||||
</p>
|
||||
</xsl:template>
|
||||
<xsl:template match="Description">
|
||||
<p>
|
||||
<xsl:if test="string-length(.) > 0">
|
||||
<span class="optional-prodnote"><strong>Description</strong>: </span>
|
||||
</xsl:if>
|
||||
<xsl:call-template name="apply-templates-lang"/>
|
||||
</p>
|
||||
<xsl:if test="string-length(.) > 0">
|
||||
<p>
|
||||
<span class="required-prodnote"><strong>Description</strong></span>: <xsl:call-template
|
||||
name="apply-templates-lang"/>
|
||||
</p>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template match="Label">
|
||||
<p>
|
||||
|
@ -246,14 +281,35 @@
|
|||
<xsl:call-template name="apply-templates-lang"/>
|
||||
</p>
|
||||
</xsl:template>
|
||||
<xsl:template match="Timing/Hours"><br/><xsl:call-template name="apply-templates-lang"/> hours<br/>
|
||||
</xsl:template>
|
||||
<xsl:template match="Timing/Minutes"><br/><xsl:call-template name="apply-templates-lang"/> minutes<br/>
|
||||
</xsl:template>
|
||||
<xsl:template match="Timing/Hours"><br/><xsl:call-template name="apply-templates-lang"/>
|
||||
hours<br/>
|
||||
</xsl:template>
|
||||
<xsl:template match="Timing/Minutes"><br/><xsl:call-template name="apply-templates-lang"/>
|
||||
minutes<br/>
|
||||
</xsl:template>
|
||||
<xsl:template match="Quote">
|
||||
<blockquote>
|
||||
<xsl:call-template name="apply-templates-lang"/>
|
||||
</blockquote>
|
||||
</xsl:template>
|
||||
<xsl:template match="Imprint"/>
|
||||
<xsl:template name="handle-sidenotes">
|
||||
<xsl:if test="count(./SideNote) > 0">
|
||||
<hr/>
|
||||
<xsl:for-each select="./SideNote">
|
||||
<xsl:call-template name="apply-templates-lang">
|
||||
<xsl:with-param name="filter-sidenotes">false</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
<hr/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template name="handle-footnotes">
|
||||
<xsl:if test="count(./footnote) > 0">
|
||||
<xsl:for-each select="./footnote">
|
||||
<p><strong>Footnote <xsl:value-of select="count(preceding::footnote) + 1"/></strong>:
|
||||
<xsl:apply-templates select="text()|./*"/></p>
|
||||
</xsl:for-each>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
|
Loading…
Reference in New Issue