Commit 9d90226e authored by Wendell Piez's avatar Wendell Piez

Merge branch 'ink-api-publish' into 'master'

Ink api publish

See merge request !1
parents 8923ab58 c820279e
XSLT transformations for conversion of HTML Typescript
(as emitted by XSweet) into an "Editoria-flavored" HTML
for import by Editoria.
XSLT transformations for conversion of HTML Typescript
(as emitted by XSweet) into an "Editoria-flavored" HTML
for import by Editoria.
......@@ -50,7 +50,7 @@
</xsl:template>
<xsl:template match="key('elements-by-class','FootnoteReference') | key('elements-by-class','EndnoteReference')">
<xsl:apply-templates/>
<xsl:apply-templates select=".//a"/>
</xsl:template>
<xsl:template match="key('elements-by-class','footnoteReference') | key('elements-by-class','endnoteReference')">
......@@ -86,6 +86,10 @@
</i>
</xsl:template>
<!-- Explicit end notes given in source are dropped for Editoria -->
<xsl:template priority="10" match="span[@class=('footnoteRef','endnoteRef')]"/>
<!-- We declare a key that enables us to match elements based on 'class' (attribute) values.
Any element with a non-ws @class may be so matched (and retrieved).
Since 'class' may be overloaded this is a many-to-many match, so template
......
......@@ -69,6 +69,15 @@
<xsl:apply-templates select="." mode="copy-after-all"/>
</xsl:template>
<!-- Special adjustments for Editoria -->
<xsl:template priority="10" match="sup[empty(* except note)]">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="span[@class=('footnoteRef','endnoteRef')]"/>
<!-- BUT - special handling for internal-to-Word bookmarks (as produced by XSweet) -
these are always empty and we don't want their (comment) content either. -->
<xsl:template match="a[starts-with(@id,'docx-bookmark')] | a[starts-with(@href,'#docx-bookmark')]"/>
......@@ -77,18 +86,20 @@
<xsl:apply-templates select="." mode="copy-after-all"/>
</xsl:template>
<xsl:template match="node()" mode="comment-in"/>
<!--<xsl:template match="node()" mode="comment-in"/>
<xsl:template match="p//* | td//*" mode="comment-in">
<xsl:if test="not(matches(string(.),'\S'))">
<xsl:comment> open/close </xsl:comment>
</xsl:if>
</xsl:template>
</xsl:template>-->
<xsl:template match="node() | @*" mode="copy-after-all">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="." mode="comment-in"/>
<!--<xsl:apply-templates select="." mode="comment-in"/>-->
<!-- switching back out of mode -->
<xsl:apply-templates/>
</xsl:copy>
......
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step version="1.0"
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:xsw="http://coko.foundation/xsweet"
type="xsw:xsweet-editoria-filter" name="xsweet-editoria-filter">
<!-- Implementing a mapping to modify an HTML document wrt @style and @class -->
<p:input port="source" primary="true"/>
<p:input port="parameters" kind="parameter"/>
<p:output port="_Z_FINAL" primary="true">
<p:pipe port="result" step="final"/>
</p:output>
<p:output port="_A_linebroken" primary="false">
<p:pipe port="result" step="break-paragraphs-at-breaks"/>
</p:output>
<p:output port="_C_mapping" primary="false">
<p:pipe port="result" step="editoria-basic"/>
</p:output>
<p:output port="_D_cleanup" primary="false">
<p:pipe port="result" step="editoria-reduce"/>
</p:output>
<p:output port="_E_tuneup" primary="false">
<p:pipe port="result" step="editoria-tune"/>
</p:output>
<p:serialization port="_Z_FINAL" indent="true" omit-xml-declaration="true"/>
<!-- Since Editoria doesn't recognize br, we break paragraphs around them. -->
<p:xslt name="break-paragraphs-at-breaks">
<p:input port="stylesheet">
<p:document href="p-split-around-br.xsl"/>
</p:input>
</p:xslt>
<p:xslt name="editoria-notes">
<p:input port="stylesheet">
<p:document href="editoria-notes.xsl"/>
</p:input>
</p:xslt>
<!-- Then, the ad-hoc mapping for Editoria. -->
<p:xslt name="editoria-basic">
<p:input port="stylesheet">
<p:document href="editoria-basic.xsl"/>
</p:input>
</p:xslt>
<!-- A cleanup pass to enforce global (fallback) mapping rules. -->
<p:xslt name="editoria-reduce">
<p:input port="stylesheet">
<p:document href="editoria-reduce.xsl"/>
</p:input>
</p:xslt>
<!-- Final "tuneup" including local editorial pre-processes / macros. -->
<p:xslt name="editoria-tune">
<p:input port="stylesheet">
<p:document href="editoria-tune.xsl"/>
</p:input>
</p:xslt>
<p:identity name="final"/>
<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step version="1.0"
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:xsw="http://coko.foundation/xsweet"
type="xsw:xsweet-editoria-filter" name="xsweet-editoria-filter">
<!-- Implementing a mapping to modify an HTML document wrt @style and @class -->
<p:input port="source" primary="true"/>
<p:input port="parameters" kind="parameter"/>
<p:output port="_Z_FINAL" primary="true">
<p:pipe port="result" step="final"/>
</p:output>
<p:output port="_A_linebroken" primary="false">
<p:pipe port="result" step="break-paragraphs-at-breaks"/>
</p:output>
<p:output port="_C_mapping" primary="false">
<p:pipe port="result" step="editoria-basic"/>
</p:output>
<p:output port="_D_cleanup" primary="false">
<p:pipe port="result" step="editoria-reduce"/>
</p:output>
<p:output port="_E_tuneup" primary="false">
<p:pipe port="result" step="editoria-tune"/>
</p:output>
<p:serialization port="_Z_FINAL" indent="true" omit-xml-declaration="true"/>
<!-- Since Editoria doesn't recognize br, we break paragraphs around them. -->
<p:xslt name="break-paragraphs-at-breaks">
<p:input port="stylesheet">
<p:document href="p-split-around-br.xsl"/>
</p:input>
</p:xslt>
<p:xslt name="editoria-notes">
<p:input port="stylesheet">
<p:document href="editoria-notes.xsl"/>
</p:input>
</p:xslt>
<!-- Then, the ad-hoc mapping for Editoria. -->
<p:xslt name="editoria-basic">
<p:input port="stylesheet">
<p:document href="editoria-basic.xsl"/>
</p:input>
</p:xslt>
<!-- A cleanup pass to enforce global (fallback) mapping rules. -->
<p:xslt name="editoria-reduce">
<p:input port="stylesheet">
<p:document href="editoria-reduce.xsl"/>
</p:input>
</p:xslt>
<!-- Final "tuneup" including local editorial pre-processes / macros. -->
<p:xslt name="editoria-tune">
<p:input port="stylesheet">
<p:document href="editoria-tune.xsl"/>
</p:input>
</p:xslt>
<p:identity name="final"/>
</p:declare-step>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment