- From: Andreas Mixich <mixich.andreas@gmail.com>
- Date: Sun, 10 Dec 2017 08:40:13 +0100
- To: XProc Dev <xproc-dev@w3.org>
Hi,
in a folder I want to convert all Markdown (`*.md`) files via *Pandoc* into XHTML and then make them into an ePub.
This is the folder:
```
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\toc.md
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\build
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\apA.md
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\ch1.md
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\ch2.md
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\ch3.md
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\cover.jpg
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\fig1.png
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\fig2.png
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\fig3.png
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\fig4.png
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\fig5.png
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\fig6.png
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\foreword.md
S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS\up & going\README.md
```
During developing the pipeline, something strange occured: Executing it
via *Calabash* the pipeline will write itself 63 times onto the `result`
port! I assume, that this is due to the `p:load` loading the pipeline
file, but the `href` attribute clearly does not call for it.
```xml
<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step name="main"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:l="http://xproc.org/library"
xmlns:cx="http://xmlcalabash.com/ns/extensions"
xmlns:pxp="http://exproc.org/proposed/steps"
version="1.0">
<p:serialization port="result"
method="xml"
indent="true"/>
<p:option name="basedir" select="'S:/Users/me/Eigene Projekte/eBook/You-Dont-Know-JS'"/>
<p:input port="source" sequence="true">
<p:empty/>
</p:input>
<p:input port="parameters" kind="parameter"/>
<p:output port="result" sequence="true"/>
<!--<p:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl"/>-->
<p:import href="file:/C:/Users/me/lib/new-recursive-directory-list.xpl"/>
<p:import href="file:/C:/Users/me/lib/gfm-to-xhtml-stream.xpl"/>
<p:variable name="baseuri" select="resolve-uri(concat('file:/',encode-for-uri($basedir)))"/>
<l:recursive-directory-list name="list-dir" exclude-filter=".*.git">
<p:with-option name="path" select="concat('file:/',$basedir)"/>
</l:recursive-directory-list>
<p:for-each name="loop1">
<p:iteration-source select="c:directory/c:directory"/>
<p:for-each name="loop2">
<p:iteration-source select="c:directory/c:file[contains(@name,'.md')]"/>
<p:load>
<p:with-option name="href" select="concat(c:directory/@xml:base, c:directory/c:file[contains(@name,'.md')])"/>
</p:load>
<p:identity/>
</p:for-each>
</p:for-each>
</p:declare-step>
```
(I am pretty sure, that I do something wrong, currently it is not really clear to me, what the context node is in such a case)
If I try to run the pipeline via *MorganaXProc* I get an `access denied` error:
err:XD0011: Couldnt load document 'file:/S:/Users/me/Eigene%20Projekte/eBook/You-Dont-Know-JS/': S:\Users\me\Eigene Projekte\eBook\You-Dont-Know-JS (Zugriff verweigert)
My security configuration for this path looks like this:
```xml
<mox:SecurityControl operation="read_resource" path="file:/S:/Users/me/Eigene%20Projekte/" allowed="true"/>
<mox:SecurityControl operation="read_resource" path="file:/S:/Users/me/Eigene%20Projekte/eBook/You-Dont-Know-JS/" allowed="true"/>
```
--
Goody Bye, Minden jót, Mit freundlichen Grüßen,
Andreas Mixich
Received on Sunday, 10 December 2017 07:40:37 UTC