-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
2,330 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<p:declare-step xmlns:p="https://www.w3.org/ns/xproc" | ||
xmlns:c="https://www.w3.org/ns/xproc-step" | ||
xmlns:cx="https://xmlcalabash.com/ns/extensions" | ||
xmlns:xsl="https://www.w3.org/1999/XSL/Transform" | ||
xmlns:xs="https://www.w3.org/2001/XMLSchema" | ||
xmlns:docx2hub="https://transpect.io/docx2hub" | ||
xmlns:w="https://schemas.openxmlformats.org/wordprocessingml/2006/main" | ||
xmlns:o="urn:schemas-microsoft-com:office:office" | ||
xmlns:rel="https://schemas.openxmlformats.org/package/2006/relationships" | ||
xmlns:r="https://schemas.openxmlformats.org/officeDocument/2006/relationships" | ||
xmlns:tr="https://transpect.io" | ||
version="1.0" | ||
name="apply-changemarkup" | ||
type="docx2hub:apply-changemarkup"> | ||
|
||
<p:input port="source" primary="true"> | ||
<p:documentation>The result of docx2hub:single-tree (or mathtype2mml)</p:documentation> | ||
</p:input> | ||
<p:input port="params"> | ||
<p:documentation>The params output port of docx2hub:single-tree</p:documentation> | ||
</p:input> | ||
<p:input port="stylesheet"> | ||
<p:document href="../xsl/main.xsl"/> | ||
</p:input> | ||
<p:input port="schematron"> | ||
<p:document href="../sch/changemarkup.sch.xml"/> | ||
</p:input> | ||
|
||
<p:output port="result" primary="true"> | ||
<p:documentation>The same basic structure as the primary source of the current step, but with applied markup changes (such as text deletions or image insertions)</p:documentation> | ||
<p:pipe port="result" step="convert-apply-changemarkup"/> | ||
</p:output> | ||
<p:output port="report" sequence="true"> | ||
<p:pipe port="report" step="convert-apply-changemarkup"/> | ||
</p:output> | ||
<p:output port="schema" sequence="true"> | ||
<p:pipe port="result" step="schematron-atts"/> | ||
</p:output> | ||
|
||
<p:serialization port="result" omit-xml-declaration="false"/> | ||
|
||
<p:option name="debug" required="false" select="'no'"/> | ||
<p:option name="debug-dir-uri" required="false" select="'file:/tmp/debug'"/> | ||
<p:option name="fail-on-error" select="'no'"/> | ||
<p:option name="active" required="false" select="'yes'"> | ||
<p:documentation>Whether apply-changemarkup conversion happens at all.</p:documentation> | ||
</p:option> | ||
|
||
<p:import href="https://xmlcalabash.com/extension/steps/library-1.0.xpl"/> | ||
<p:import href="https://transpect.io/xproc-util/xslt-mode/xpl/xslt-mode.xpl"/> | ||
|
||
<p:choose name="convert-apply-changemarkup"> | ||
<p:when test="$active = 'yes' and exists(//w:del | //w:moveFrom | //w:ins)"> | ||
<p:output port="result" primary="true"> | ||
<p:pipe port="result" step="apply-changemarkup-xslt"/> | ||
</p:output> | ||
<p:output port="report" sequence="true"> | ||
<p:pipe port="result" step="check"/> | ||
</p:output> | ||
|
||
<p:variable name="basename" select="/c:param-set/c:param[@name = 'basename']/@value"> | ||
<p:pipe step="apply-changemarkup" port="params"/> | ||
</p:variable> | ||
|
||
<tr:xslt-mode msg="yes" mode="docx2hub:apply-changemarkup" name="apply-changemarkup-xslt"> | ||
<p:input port="parameters"> | ||
<p:pipe step="apply-changemarkup" port="params"/> | ||
</p:input> | ||
<p:input port="stylesheet"> | ||
<p:pipe step="apply-changemarkup" port="stylesheet"/> | ||
</p:input> | ||
<p:input port="models"> | ||
<p:empty/> | ||
</p:input> | ||
<p:with-option name="prefix" select="concat('docx2hub/', $basename, '/02a-apply-changemarkup')"/> | ||
<p:with-option name="debug" select="$debug"/> | ||
<p:with-option name="debug-dir-uri" select="$debug-dir-uri"/> | ||
<p:with-option name="fail-on-error" select="$fail-on-error"/> | ||
<p:with-param name="fail-on-error" select="$fail-on-error"/> | ||
</tr:xslt-mode> | ||
|
||
<p:validate-with-schematron assert-valid="false" name="val-sch"> | ||
<p:input port="schema"> | ||
<p:pipe port="schematron" step="apply-changemarkup"/> | ||
</p:input> | ||
<p:input port="parameters"><p:empty/></p:input> | ||
<p:with-param name="allow-foreign" select="'true'"/> | ||
</p:validate-with-schematron> | ||
|
||
<p:sink/> | ||
|
||
<p:add-attribute name="check0" match="/*" | ||
attribute-name="tr:rule-family" attribute-value="docx2hub_changemarkup"> | ||
<p:input port="source"> | ||
<p:pipe port="report" step="val-sch"/> | ||
</p:input> | ||
</p:add-attribute> | ||
|
||
<p:insert name="check" match="/*" position="first-child"> | ||
<p:input port="insertion" select="/*/*:title"> | ||
<p:pipe port="schematron" step="apply-changemarkup"/> | ||
</p:input> | ||
</p:insert> | ||
|
||
</p:when> | ||
<p:when test="$active = 'check'"> | ||
<p:output port="result" primary="true"> | ||
<p:pipe port="result" step="apply-changemarkup-identity"/> | ||
</p:output> | ||
<p:output port="report" sequence="true"> | ||
<p:pipe port="result" step="check"/> | ||
</p:output> | ||
|
||
<p:identity name="apply-changemarkup-identity"/> | ||
|
||
<p:validate-with-schematron assert-valid="false" name="val-sch"> | ||
<p:input port="schema"> | ||
<p:pipe port="schematron" step="apply-changemarkup"/> | ||
</p:input> | ||
<p:input port="parameters"><p:empty/></p:input> | ||
<p:with-param name="allow-foreign" select="'true'"/> | ||
</p:validate-with-schematron> | ||
|
||
<p:sink/> | ||
|
||
<p:add-attribute name="check0" match="/*" | ||
attribute-name="tr:rule-family" attribute-value="docx2hub_changemarkup"> | ||
<p:input port="source"> | ||
<p:pipe port="report" step="val-sch"/> | ||
</p:input> | ||
</p:add-attribute> | ||
|
||
<p:insert name="check" match="/*" position="first-child"> | ||
<p:input port="insertion" select="/*/*:title"> | ||
<p:pipe port="schematron" step="apply-changemarkup"/> | ||
</p:input> | ||
</p:insert> | ||
|
||
</p:when> | ||
<p:otherwise> | ||
<p:output port="result" primary="true"/> | ||
<p:output port="report" sequence="true"> | ||
<p:empty/> | ||
</p:output> | ||
<p:identity/> | ||
</p:otherwise> | ||
</p:choose> | ||
|
||
<p:sink/> | ||
|
||
<p:add-attribute match="/*" | ||
attribute-name="tr:step-name" | ||
attribute-value="docx2hub"> | ||
<p:input port="source"> | ||
<p:pipe port="schematron" step="apply-changemarkup"/> | ||
</p:input> | ||
</p:add-attribute> | ||
|
||
<p:add-attribute | ||
match="/*" | ||
attribute-name="tr:rule-family" | ||
attribute-value="docx2hub"> | ||
</p:add-attribute> | ||
|
||
<p:insert name="schematron-atts" match="/*" position="first-child"> | ||
<p:input port="insertion" select="/*/*:title"> | ||
<p:pipe port="schematron" step="apply-changemarkup"/> | ||
</p:input> | ||
</p:insert> | ||
|
||
<p:sink/> | ||
|
||
</p:declare-step> |
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,82 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<p:declare-step xmlns:p="https://www.w3.org/ns/xproc" | ||
xmlns:c="https://www.w3.org/ns/xproc-step" | ||
xmlns:cx="https://xmlcalabash.com/ns/extensions" | ||
xmlns:tr="https://transpect.io" | ||
xmlns:xsl="https://www.w3.org/1999/XSL/Transform" | ||
xmlns:docx2hub="https://transpect.io/docx2hub" | ||
xmlns:hub2htm="https://transpect.io/hub2htm" | ||
xmlns:w="https://schemas.openxmlformats.org/wordprocessingml/2006/main" | ||
version="1.0" | ||
name="docx2html" | ||
type="docx2hub:docx2html"> | ||
|
||
<p:documentation xmlns="https://www.w3.org/1999/xhtml"> | ||
<p>Converts docx to XHTML</p> | ||
</p:documentation> | ||
|
||
<p:input port="docx2hub-xslt"> | ||
<p:document href="../xsl/main.xsl"/> | ||
</p:input> | ||
<p:input port="source" primary="true"> | ||
<p:documentation>This is to prevent a default readable port connecting to this step’s xslt port.</p:documentation> | ||
<p:empty/> | ||
</p:input> | ||
<p:input port="paths"> | ||
<p:empty/> | ||
</p:input> | ||
<p:output port="result" primary="true"/> | ||
<p:serialization port="result" method="xhtml" omit-xml-declaration="false"/> | ||
<p:output port="hub"> | ||
<p:pipe port="result" step="docx2hub"/> | ||
</p:output> | ||
<p:serialization port="hub" omit-xml-declaration="false"/> | ||
|
||
<p:option name="docx" required="true"> | ||
<p:documentation>OS name (preferably with full path, may not resolve if only a relative path is given), file:, http:, or | ||
https: URL. The file will be fetched first if it is an HTTP URL.</p:documentation> | ||
</p:option> | ||
<p:option name="debug" required="false" select="'no'"/> | ||
<p:option name="debug-dir-uri" required="false" select="'debug'"/> | ||
<p:option name="srcpaths" required="false" select="'no'"/> | ||
<p:option name="unwrap-tooltip-links" required="false" select="'no'"/> | ||
<p:option name="hub-version" required="false" select="'1.2'"/> | ||
<p:option name="fail-on-error" required="false" select="'no'"/> | ||
<p:option name="extract-dir" required="false" select="''"> | ||
<p:documentation>Directory (OS path, not file: URL) to which the file will be unzipped. If option is empty string, will be | ||
'.tmp' appended to OS file path.</p:documentation> | ||
</p:option> | ||
<p:option name="create-svg" required="false" select="'false'"> | ||
<p:documentation>Whether Office Open Drawing ML should be mapped to SVG</p:documentation> | ||
</p:option> | ||
|
||
<p:import href="https://xmlcalabash.com/extension/steps/library-1.0.xpl"/> | ||
<p:import href="https://transpect.io/hub2html/xpl/hub2html.xpl"/> | ||
|
||
<p:import href="docx2hub.xpl"/> | ||
|
||
<docx2hub:convert name="docx2hub" charmap-policy="msoffice"> | ||
<p:with-option name="docx" select="$docx"/> | ||
<p:with-option name="debug" select="$debug"/> | ||
<p:with-option name="debug-dir-uri" select="$debug-dir-uri"/> | ||
<p:with-option name="hub-version" select="$hub-version"/> | ||
<p:with-option name="unwrap-tooltip-links" select="$unwrap-tooltip-links"/> | ||
<p:with-option name="fail-on-error" select="$fail-on-error"/> | ||
<p:with-option name="srcpaths" select="$srcpaths"/> | ||
<p:with-option name="extract-dir" select="$extract-dir"/> | ||
<p:with-option name="create-svg" select="$create-svg"/> | ||
<p:input port="xslt"> | ||
<p:pipe step="docx2html" port="docx2hub-xslt"/> | ||
</p:input> | ||
</docx2hub:convert> | ||
|
||
<hub2htm:convert name="hub2html"> | ||
<p:input port="paths"> | ||
<p:pipe port="paths" step="docx2html"/> | ||
</p:input> | ||
<p:input port="other-params"><p:empty/></p:input> | ||
<p:with-option name="debug" select="$debug"/> | ||
<p:with-option name="debug-dir-uri" select="$debug-dir-uri"/> | ||
</hub2htm:convert> | ||
|
||
</p:declare-step> |
Oops, something went wrong.