Skip to content

Commit

Permalink
refactor harvester pipelines, add ZIP feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Conal-Tuohy committed Feb 2, 2024
1 parent b04e62d commit 4f34950
Show file tree
Hide file tree
Showing 5 changed files with 343 additions and 92 deletions.
92 changes: 92 additions & 0 deletions src/xproc/recursive-directory-list.xpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="1.0"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:l="http://xproc.org/library"
type="l:recursive-directory-list">
<p:output port="result"/>
<p:option name="path" required="true"/>
<p:option name="include-filter"/>
<p:option name="exclude-filter"/>
<p:option name="depth" select="-1"/>

<p:documentation>
<a href="http://xproc.org/library/recursive-directory-list.xpl">http://xproc.org/library/recursive-directory-list.xpl</a>
</p:documentation>

<p:choose>
<p:when test="p:value-available('include-filter')
and p:value-available('exclude-filter')">
<p:directory-list>
<p:with-option name="path" select="$path"/>
<p:with-option name="include-filter" select="$include-filter"/>
<p:with-option name="exclude-filter" select="$exclude-filter"/>
</p:directory-list>
</p:when>

<p:when test="p:value-available('include-filter')">
<p:directory-list>
<p:with-option name="path" select="$path"/>
<p:with-option name="include-filter" select="$include-filter"/>
</p:directory-list>
</p:when>

<p:when test="p:value-available('exclude-filter')">
<p:directory-list>
<p:with-option name="path" select="$path"/>
<p:with-option name="exclude-filter" select="$exclude-filter"/>
</p:directory-list>
</p:when>

<p:otherwise>
<p:directory-list>
<p:with-option name="path" select="$path"/>
</p:directory-list>
</p:otherwise>
</p:choose>

<p:viewport match="/c:directory/c:directory">
<p:variable name="name" select="/*/@name"/>

<p:choose>
<p:when test="$depth != 0">
<p:choose>
<p:when test="p:value-available('include-filter')
and p:value-available('exclude-filter')">
<l:recursive-directory-list>
<p:with-option name="path" select="concat($path,'/',$name)"/>
<p:with-option name="include-filter" select="$include-filter"/>
<p:with-option name="exclude-filter" select="$exclude-filter"/>
<p:with-option name="depth" select="$depth - 1"/>
</l:recursive-directory-list>
</p:when>

<p:when test="p:value-available('include-filter')">
<l:recursive-directory-list>
<p:with-option name="path" select="concat($path,'/',$name)"/>
<p:with-option name="include-filter" select="$include-filter"/>
<p:with-option name="depth" select="$depth - 1"/>
</l:recursive-directory-list>
</p:when>

<p:when test="p:value-available('exclude-filter')">
<l:recursive-directory-list>
<p:with-option name="path" select="concat($path,'/',$name)"/>
<p:with-option name="exclude-filter" select="$exclude-filter"/>
<p:with-option name="depth" select="$depth - 1"/>
</l:recursive-directory-list>
</p:when>

<p:otherwise>
<l:recursive-directory-list>
<p:with-option name="path" select="concat($path,'/',$name)"/>
<p:with-option name="depth" select="$depth - 1"/>
</l:recursive-directory-list>
</p:otherwise>
</p:choose>
</p:when>
<p:otherwise>
<p:identity/>
</p:otherwise>
</p:choose>
</p:viewport>

</p:declare-step>
Loading

0 comments on commit 4f34950

Please sign in to comment.