Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • bibliothek-der-neologie/intermediate-format
1 result
Show changes
Commits on Source (27)
Showing with 1057 additions and 205 deletions
expath-pkg.xml expath-pkg.xml
/archive /archive
/build /.build
/xml /xml
/local
/logs /logs
/test /test
.DS_Store .DS_Store
.com.apple.timemachine.supported .com.apple.timemachine.supported
node_modules
image: docker.gitlab.gwdg.de/fontane-notizbuecher/build:latest image: docker.gitlab.gwdg.de/sade/build:latest
stages: stages:
- build - build
- test - test
- deploy - release
build-develop: .npm-setup: &npm-setup
except: - curl -sL https://deb.nodesource.com/setup_12.x | bash -
- master - apt-get install -y nodejs
- tags - npm ci --unsafe-perm --cache .npm --prefer-offline
stage: build
script:
- ant
artifacts:
paths:
- build/*.xar
build-master:
only: build:
- master
stage: build stage: build
script: script:
- cp master.build.properties local.build.properties - ./build
- ant
artifacts: artifacts:
paths: paths:
- build/*.xar - .build/*.xar
except:
- tags
installation: installation:
except: except:
...@@ -33,23 +27,21 @@ installation: ...@@ -33,23 +27,21 @@ installation:
stage: test stage: test
script: script:
- ant test - ant test
- bash test/eXist-db-*/bin/startup.sh | tee output.log & - bash local/exist-db/bin/startup.sh | tee output.log &
# wait for eXist # wait for eXist
- while [ $(curl --head --silent http://localhost:8080 | grep -c "200 OK") == 0 ]; do sleep 2s; done - while [ $(curl --head --silent http://localhost:8080 | grep -c "200 OK") == 0 ]; do sleep 2s; done
# shutdown eXist # shutdown eXist
- bash test/eXist-db-*/bin/shutdown.sh - bash local/exist-db/bin/shutdown.sh
artifacts: artifacts:
paths: paths:
- output.log - output.log
- test/eXist-db-*/webapp/WEB-INF/logs/expath-repo.log - local/exist-db/webapp/WEB-INF/logs/expath-repo.log
upload: release:
only: stage: release
- master before_script:
- develop - *npm-setup
except:
- tags
stage: deploy
script: script:
- FILENAME=$(ls build/*.xar) - npx semantic-release
- curl -u ci:${EXIST_UPLOAD_PW} -X POST -F file=@${FILENAME} https://ci.de.dariah.eu/exist-upload only:
- master
# [1.3.0](https://gitlab.gwdg.de/bibliothek-der-neologie/intermediate-format/compare/v1.2.0...v1.3.0) (2021-04-12)
### Bug Fixes
* **ifweb:** register library modules ([ea33a54](https://gitlab.gwdg.de/bibliothek-der-neologie/intermediate-format/commit/ea33a547dd1c8228dc17d3d543d56700a0b19d19)), closes [#5](https://gitlab.gwdg.de/bibliothek-der-neologie/intermediate-format/issues/5)
* **semantic-release:** change release branch from `production` to master ([9fb57d9](https://gitlab.gwdg.de/bibliothek-der-neologie/intermediate-format/commit/9fb57d97659502a4597fa2f05060f5039b5ccd9c))
* **whitespaces:** do not purge single spaces ([4aade28](https://gitlab.gwdg.de/bibliothek-der-neologie/intermediate-format/commit/4aade28993c597c23aa1bdf59630001f1e5a3d1e)), closes [#3](https://gitlab.gwdg.de/bibliothek-der-neologie/intermediate-format/issues/3)
### Features
* **semantic-release:** provide helper scripts for semantic-release ([dbf8b19](https://gitlab.gwdg.de/bibliothek-der-neologie/intermediate-format/commit/dbf8b1940a88499f1156380b0c562e35bc309444))
# Changelog # Changelog
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ This repository contains the BdN IntermediateFormat-conversion application to pr ...@@ -8,7 +8,7 @@ This repository contains the BdN IntermediateFormat-conversion application to pr
# Setup # Setup
- call `ant` to build the app as `build/interformat.{VERSION}.xar` - call `./build` to build the app as `.build/interformat-{VERSION}.xar`
- integrate it into your eXistDB instance - integrate it into your eXistDB instance
......
#!/bin/bash
ant
project.abbrev=interformat-dev
project.title=BdN Intermediate Format (Development)
project.version=${env.SR_PV}+${env.CI_COMMIT_SHORT_SHA}
\ No newline at end of file
project.abbrev=interformat
project.title=BdN Intermediate Format
project.version=${env.SR_PV}
\ No newline at end of file
project.name=http://bdn-edition.de/intermediate_format-develop
project.version=1.2
project.title=BdN Intermediate Format
project.abbrev=interformat-develop
project.processorversion=4.6.0
destfile=${build.dir}/${project.abbrev}-${project.version}.xar
test.dir=test
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project default="xar" name="interformat" xmlns:xdb="http://exist-db.org/ant"> <project default="xar" name="interformat" xmlns:xdb="http://exist-db.org/ant">
<property environment="env"/> <!-- bind environment variables to 'env'//-->
<property name="build.dir" value="build"/> <property environment="env" />
<property file="local.build.properties"/> <property file="build.${env.BRANCH}.properties" />
<property file="build.properties"/>
<xmlproperty file="expath-pkg.xml.tmpl"/> <!-- default values for building outside CI //-->
<property name="project.abbrev" value="interformat-local" />
<target name="xar" depends="cleanup"> <property name="project.name" value="http://bdn-edition.de/${project.abbrev}" />
<copy file="expath-pkg.xml.tmpl" tofile="expath-pkg.xml" filtering="true" overwrite="true"> <property name="project.version" value="1.2.0" />
<filterset> <property name="project.title" value="BdN Intermediate Format (Local)" />
<filter token="project.version" value="${project.version}"/> <property name="project.processorversion" value="5.2.0" />
<filter token="project.title" value="${project.title}"/>
<filter token="project.abbrev" value="${project.abbrev}"/> <!-- generic properties //-->
<filter token="project.name" value="${project.name}"/> <property name="build.dir" value=".build" />
<filter token="project.processorversion" value="${project.processorversion}"/> <property name="test.dir" value="local" />
</filterset>
</copy> <xmlproperty file="expath-pkg.xml.tmpl" />
<mkdir dir="${build.dir}"/>
<zip basedir="." destfile="${destfile}" <property name="destfile" value="${build.dir}/${project.abbrev}-${project.version}.xar" />
excludes="${build.dir}/*,${test.dir}/*"/>
</target> <target name="xar">
<echo message="Creating expath-pkg.xml for ${project.abbrev}-${project.version}" />
<target name="cleanup"> <copy file="expath-pkg.xml.tmpl" tofile="expath-pkg.xml" filtering="true" overwrite="true">
<delete dir="${test.dir}"/> <filterset>
</target> <filter token="project.version" value="${project.version}" />
<filter token="project.title" value="${project.title}" />
<target name="test" depends="xar"> <filter token="project.abbrev" value="${project.abbrev}" />
<get src="https://bintray.com/existdb/releases/download_file?file_path=eXist-db-${project.processorversion}.tar.bz2" dest="${build.dir}/eXist-db-${project.processorversion}.tar.bz2" skipexisting="true" /> <filter token="project.name" value="${project.name}" />
<untar src="${build.dir}/eXist-db-${project.processorversion}.tar.bz2" dest="${test.dir}" compression="bzip2" /> <filter token="project.processorversion" value="${project.processorversion}" />
</filterset>
<get src="https://ci.de.dariah.eu/exist-repo/find.zip?abbrev=sade_assets&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/sade_assets-latest.xar" ignoreerrors="true"/> </copy>
<get src="https://ci.de.dariah.eu/exist-repo/find.zip?abbrev=cv&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/codeview-latest.xar" ignoreerrors="true"/> <echo message="Creating ${project.abbrev}-${project.version}.xar" />
<get src="https://ci.de.dariah.eu/exist-repo/find.zip?abbrev=fontane-lucene-exist-module&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/fontane-lucene-latest.xar" ignoreerrors="true"/> <zip basedir="." destfile="${destfile}" excludes="${build.dir}/**, ${test.dir}/**, .hooks/**, node_modules/**" />
</target>
<get src="http://exist-db.org/exist/apps/public-repo/find.zip?abbrev=markdown&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/markdown-latest.xar" ignoreerrors="true"/>
<get src="http://exist-db.org/exist/apps/public-repo/find.zip?abbrev=functx&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/functx-latest.xar" ignoreerrors="true"/> <target name="cleanup">
<echo message="Deleting ${test.dir}" />
<copy file="${destfile}" todir="${test.dir}/eXist-db-${project.processorversion}/autodeploy" /> <delete dir="${test.dir}" />
</target> </target>
<target name="test" depends="xar">
<mkdir dir="${build.dir}" />
<!-- this path may be and is subject to change! -->
<echo message="Downloading exist-db" />
<get src="https://bintray.com/existdb/releases/download_file?file_path=exist-distribution-${project.processorversion}-unix.tar.bz2" dest="${build.dir}/exist-db.tar.bz2" skipexisting="true" />
<untar src="${build.dir}/exist-db.tar.bz2" dest="${test.dir}" compression="bzip2" />
<path id="exist_zipped_dir_name">
<dirset dir="${test.dir}">
<include name="exist*" />
</dirset>
</path>
<property name="exist-dir" refid="exist_zipped_dir_name" />
<echo message="Renaming ${exist-dir} to exist-db" />
<move file="${exist-dir}" tofile="${test.dir}/exist-db" />
<echo message="Downloading applets" />
<get src="https://ci.de.dariah.eu/exist-repo/find.zip?abbrev=sade_assets&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/sade_assets-latest.xar" ignoreerrors="true" />
<get src="https://ci.de.dariah.eu/exist-repo/find.zip?abbrev=cv&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/codeview-latest.xar" ignoreerrors="true" />
<get src="https://ci.de.dariah.eu/exist-repo/find.zip?abbrev=fontane-lucene-exist-module&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/fontane-lucene-latest.xar" ignoreerrors="true" />
<get src="http://exist-db.org/exist/apps/public-repo/find.zip?abbrev=markdown&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/markdown-latest.xar" ignoreerrors="true" />
<get src="http://exist-db.org/exist/apps/public-repo/find.zip?abbrev=functx&amp;processor=${project.processorversion}" dest="${test.dir}/eXist-db-${project.processorversion}/autodeploy/functx-latest.xar" ignoreerrors="true" />
<echo message="Moving ${project.abbrev}-${project.version}.xar to autodeploy directory" />
<copy file="${destfile}" todir="${test.dir}/exist-db/autodeploy" />
<chmod
dir="${test.dir}/exist-db/bin"
perm="ugo+rx"
includes="**/*.sh"
/>
</target>
</project> </project>
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://expath.org/ns/pkg"
name="http://bdn-edition.de/intermediate_format"
abbrev="interformat-develop"
version="1.0.0"
spec="1.0">
<title>BdN Intermediate Format</title>
<dependency processor="http://exist-db.org" semver-min="4.5.0"/>
<dependency package="http://exist-db.org/apps/shared"/>
<xquery>
<namespace>http://bdn-edition.de/intermediate_format</namespace>
<file>ifweb.xqm</file>
</xquery>
</package>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dependency processor="http://exist-db.org" semver-min="@project.processorversion@"/> <dependency processor="http://exist-db.org" semver-min="@project.processorversion@"/>
<dependency package="http://exist-db.org/apps/shared"/> <dependency package="http://exist-db.org/apps/shared"/>
<xquery> <xquery>
<namespace>http://bdn-edition.de/intermediate_format</namespace> <namespace>http://bdn-edition.de/intermediate_format/ifweb</namespace>
<file>ifweb.xqm</file> <file>ifweb.xql</file>
</xquery> </xquery>
</package> </package>
project.name=http://bdn-edition.de/intermediate_format
project.abbrev=interformat
\ No newline at end of file
xquery version "3.0"; xquery version "3.0";
(:
: Copyright (c) 2018 Uwe Sikora
: Copyright (c) 2018–2019 Michelle Weidling
: Copyright (c) 2020 Stefan Hynek
:
: This file is part of intermediate-format.
:
: intermediate-format is free software: you can redistribute it and/or modify
: it under the terms of the GNU General Public License as published by
: the Free Software Foundation, either version 3 of the License, or
: (at your option) any later version.
:
: intermediate-format is distributed in the hope that it will be useful,
: but WITHOUT ANY WARRANTY; without even the implied warranty of
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: GNU General Public License for more details.
:
: You should have received a copy of the GNU General Public License
: along with intermediate-format. If not, see <https://www.gnu.org/licenses/>.
:)
(:~ (:~
: PRESENTATION Module ("presentation", "http://bdn-edition.de/intermediate_format/presentation") : PRESENTATION Module ("presentation", "http://bdn-edition.de/intermediate_format/presentation")
: ******************************************************************************************* : *******************************************************************************************
...@@ -39,74 +61,74 @@ declare function analysis:tei-body ...@@ -39,74 +61,74 @@ declare function analysis:tei-body
) )
case element(tei:abbr) return () case element(tei:abbr) return ()
case element(tei:aligned) return ( case element(tei:aligned) return (
element{"span"}{ element{"span"}{
attribute {"class"}{"aligned ble"}, attribute {"class"}{"aligned ble"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:app) return ( case element(tei:app) return (
element{"span"}{ element{"span"}{
attribute {"class"}{"app"}, attribute {"class"}{"app"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:body) return ( case element(tei:body) return (
element{"div"}{ element{"div"}{
attribute {"class"}{"body"}, attribute {"class"}{"body"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:byline) return ( case element(tei:byline) return (
element{"div"}{ element{"div"}{
attribute {"class"}{"byline"}, attribute {"class"}{"byline"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:choice) return ( case element(tei:choice) return (
analysis:tei-body($node/node()) analysis:tei-body($node/node())
) )
case element(tei:div) return ( case element(tei:div) return (
element{"div"}{ element{"div"}{
attribute {"class"}{"div ble"}, attribute {"class"}{"div ble"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:docAuthor) return ( case element(tei:docAuthor) return (
element{"div"}{ element{"div"}{
attribute {"class"}{"docAuthor ble"}, attribute {"class"}{"docAuthor ble"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:docDate) return ( case element(tei:docDate) return (
element{"span"}{ element{"span"}{
attribute {"class"}{"docDate"}, attribute {"class"}{"docDate"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:docEdition) return ( case element(tei:docEdition) return (
element{"div"}{ element{"div"}{
attribute {"class"}{"docEdition ble"}, attribute {"class"}{"docEdition ble"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:docImprint) return ( case element(tei:docImprint) return (
element{"div"}{ element{"div"}{
attribute {"class"}{"docImprint ble"}, attribute {"class"}{"docImprint ble"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:expan) return ( case element(tei:expan) return (
element{"span"}{ element{"span"}{
attribute {"class"}{"expan"}, attribute {"class"}{"expan"},
...@@ -114,7 +136,7 @@ declare function analysis:tei-body ...@@ -114,7 +136,7 @@ declare function analysis:tei-body
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:head) return ( case element(tei:head) return (
let $hierarchies := $node/ancestor::node()[name() = "div" or name() = "list" or name() = "table"] let $hierarchies := $node/ancestor::node()[name() = "div" or name() = "list" or name() = "table"]
let $count := count($hierarchies)+1 let $count := count($hierarchies)+1
...@@ -124,55 +146,55 @@ declare function analysis:tei-body ...@@ -124,55 +146,55 @@ declare function analysis:tei-body
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:hi) return ( case element(tei:hi) return (
element{"span"}{ element{"span"}{
attribute {"class"}{"hi"}, attribute {"class"}{"hi"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:index) return () case element(tei:index) return ()
case element(tei:item) return ( case element(tei:item) return (
element{"li"}{ element{"li"}{
attribute {"class"}{"item ble"}, attribute {"class"}{"item ble"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:l) return ( case element(tei:l) return (
element{"span"}{ element{"span"}{
attribute {"class"}{"l"}, attribute {"class"}{"l"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:label) return ( case element(tei:label) return (
element{"span"}{ element{"span"}{
attribute {"class"}{"label"}, attribute {"class"}{"label"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:lb) return ( case element(tei:lb) return (
element{"br"}{} element{"br"}{}
) )
case element(tei:lem) return ( case element(tei:lem) return (
if ($node/parent::tei:app[@type = "structural-variance"]) then ( if ($node/parent::tei:app[@type = "structural-variance"]) then (
analysis:tei-body($node/node()) analysis:tei-body($node/node())
) )
else( analysis:lem($node) ) else( analysis:lem($node) )
) )
case element(tei:list) return ( case element(tei:list) return (
element{"ul"}{ element{"ul"}{
attribute {"class"}{"list ble"}, attribute {"class"}{"list ble"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:milestone) return ( case element(tei:milestone) return (
analysis:tei-body($node/node()) analysis:tei-body($node/node())
) )
...@@ -183,67 +205,67 @@ declare function analysis:tei-body ...@@ -183,67 +205,67 @@ declare function analysis:tei-body
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:p) return ( case element(tei:p) return (
element{"span"}{ element{"span"}{
attribute {"class"}{"p ble"}, attribute {"class"}{"p ble"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:pb) return ( case element(tei:pb) return (
"|", <sup>{$node/string(@wit), $node/string(@n)}</sup> "|", <sup>{$node/string(@wit), $node/string(@n)}</sup>
) )
case element(tei:persName) return ( case element(tei:persName) return (
element{"span"}{ element{"span"}{
attribute {"class"}{"persName"}, attribute {"class"}{"persName"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:rdg) return ( case element(tei:rdg) return (
if ($node/parent::tei:app[@type = "structural-variance"]) then ( if ($node/parent::tei:app[@type = "structural-variance"]) then (
analysis:tei-body($node/node()) analysis:tei-body($node/node())
) )
else(analysis:rdg($node)) else(analysis:rdg($node))
) )
case element(tei:rdgMarker) return ( case element(tei:rdgMarker) return (
element {"span"}{ element {"span"}{
attribute {"class"}{"rdgMarker"}, attribute {"class"}{"rdgMarker"},
analysis:rdgMarker($node) analysis:rdgMarker($node)
} }
) )
case element(tei:seg) return ( case element(tei:seg) return (
element{"span"}{ element{"span"}{
attribute {"class"}{"seg"}, attribute {"class"}{"seg"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:text) return ( case element(tei:text) return (
element{"div"}{ element{"div"}{
attribute {"class"}{"text"}, attribute {"class"}{"text"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:TEI) return ( case element(tei:TEI) return (
element{"div"}{ element{"div"}{
attribute {"class"}{"tei"}, attribute {"class"}{"tei"},
analysis:tei-body($node/tei:text) analysis:tei-body($node/tei:text)
} }
) )
case element(tei:titlePage) return ( case element(tei:titlePage) return (
element{"div"}{ element{"div"}{
attribute {"class"}{"titlePage"}, attribute {"class"}{"titlePage"},
analysis:tei-body($node/node()) analysis:tei-body($node/node())
} }
) )
case element(tei:titlePart) return ( case element(tei:titlePart) return (
element{"div"}{ element{"div"}{
attribute {"class"}{"titlePart ble"}, attribute {"class"}{"titlePart ble"},
...@@ -277,98 +299,98 @@ declare function analysis:tei-body ...@@ -277,98 +299,98 @@ declare function analysis:tei-body
:) :)
declare function analysis:rdgMarker declare function analysis:rdgMarker
( $marker as node() ) as item()* { ( $marker as node() ) as item()* {
let $wit := replace( $marker/string(@wit), " ", "" ) let $wit := replace( $marker/string(@wit), " ", "" )
let $type := data($marker/@type) let $type := data($marker/@type)
let $mark := data($marker/@mark) let $mark := data($marker/@mark)
let $context := data($marker/@context) let $context := data($marker/@context)
return return
if ( $marker[@type="pt" and @context="lem"] ) then ( if ( $marker[@type="pt" and @context="lem"] ) then (
if ($marker[@mark="open"]) then ( if ($marker[@mark="open"]) then (
<span class="pt open">{$wit}</span> <span class="pt open">{$wit}</span>
) )
else ( else (
<span class="pt closeing">{$wit}</span> <span class="pt closeing">{$wit}</span>
) )
) )
else if ( $marker[@type="ptl" and @context="lem"] ) then ( else if ( $marker[@type="ptl" and @context="lem"] ) then (
if ($marker[@mark="open"]) then ( if ($marker[@mark="open"]) then (
<span class="ptl open">{$wit}</span> <span class="ptl open">{$wit}</span>
) )
else ( else (
<span class="ptl closeing">{$wit}</span> <span class="ptl closeing">{$wit}</span>
) )
) )
else if ( $marker[@type="ptl" and @context="rdg"] ) then ( else if ( $marker[@type="ptl" and @context="rdg"] ) then (
if ($marker[@mark="open"]) then ( if ($marker[@mark="open"]) then (
<sup>{$wit}</sup> <sup>{$wit}</sup>
) )
else ( else (
<sup>{$wit}</sup> <sup>{$wit}</sup>
) )
) )
else if ( $marker[@type="pp" and @context="lem"] ) then ( else if ( $marker[@type="pp" and @context="lem"] ) then (
if ($marker[@mark="open"]) then ( if ($marker[@mark="open"]) then (
<span class="pp open">{$wit}</span> <span class="pp open">{$wit}</span>
) )
else ( else (
<span class="pp closeing">{$wit}</span> <span class="pp closeing">{$wit}</span>
) )
) )
else if ( $marker[@type="ppl" and @context="lem"] ) then ( else if ( $marker[@type="ppl" and @context="lem"] ) then (
(: (:
if ($marker[@mark="open"]) then ( if ($marker[@mark="open"]) then (
<span class="ppl open">{concat("~/", $wit)}</span> <span class="ppl open">{concat("~/", $wit)}</span>
) )
else ( else (
<span class="ppl closeing">{concat($wit, "\~||", $wit)}</span> <span class="ppl closeing">{concat($wit, "\~||", $wit)}</span>
) :) ) :)
if ($marker[@mark="open"]) then ( if ($marker[@mark="open"]) then (
<span class="ppl open">{$wit}</span> <span class="ppl open">{$wit}</span>
) )
else ( else (
<span class="ppl closeing">{$wit}</span> <span class="ppl closeing">{$wit}</span>
) )
) )
else if ( $marker[@type="ppl" and @context="rdg"] ) then ( else if ( $marker[@type="ppl" and @context="rdg"] ) then (
if ($marker[@mark="open"]) then ( if ($marker[@mark="open"]) then (
<sup>{$wit}</sup> <sup>{$wit}</sup>
) )
else ( else (
<sup>{$wit}</sup> <sup>{$wit}</sup>
) )
) )
else if ( $marker[@type="v"] ) then ( else if ( $marker[@type="v"] ) then (
if ($marker[@mark="open"]) then ( if ($marker[@mark="open"]) then (
) )
else ( else (
<sup>{$wit}</sup> <sup>{$wit}</sup>
) )
) )
else if ( $marker[@type="om"] ) then ( else if ( $marker[@type="om"] ) then (
if ($marker[@mark="open"]) then ( if ($marker[@mark="open"]) then (
<span class="om open">{$wit}</span> <span class="om open">{$wit}</span>
) )
else ( else (
<span class="om closeing">{$wit}</span> <span class="om closeing">{$wit}</span>
) )
) )
else ( else (
element {"span"}{ element {"span"}{
attribute {"style"}{"background:orange"}, attribute {"style"}{"background:orange"},
...@@ -415,7 +437,7 @@ declare function analysis:rdg ...@@ -415,7 +437,7 @@ declare function analysis:rdg
declare function analysis:check-rdg-markers declare function analysis:check-rdg-markers
( $id as xs:string, $reading as node() ) as item()* { ( $id as xs:string, $reading as node() ) as item()* {
let $open-marker := $reading//tei:rdgMarker[@mark = "open"][@ref = $id] let $open-marker := $reading//tei:rdgMarker[@mark = "open"][@ref = $id]
let $close-marker := $reading//tei:rdgMarker[@mark = "close"][@ref = $id] let $close-marker := $reading//tei:rdgMarker[@mark = "close"][@ref = $id]
let $error := ( let $error := (
...@@ -448,7 +470,7 @@ declare function analysis:lem ...@@ -448,7 +470,7 @@ declare function analysis:lem
where not($open and $close) where not($open and $close)
return (console:log($lem//tei:rdgMarker[@mark = "open" and @context = "lem"]), $open, $close) return (console:log($lem//tei:rdgMarker[@mark = "open" and @context = "lem"]), $open, $close)
) )
return ( return (
element {"span"}{ element {"span"}{
attribute {"class"}{"reading lem"}, attribute {"class"}{"reading lem"},
...@@ -459,7 +481,7 @@ declare function analysis:lem ...@@ -459,7 +481,7 @@ declare function analysis:lem
if (data($lem/@type) != "om" or count($lem/node()) gt 0) then ( <span class="reading-content">{ analysis:tei-body( $lem/node() ) }</span> ) else (<div></div>) if (data($lem/@type) != "om" or count($lem/node()) gt 0) then ( <span class="reading-content">{ analysis:tei-body( $lem/node() ) }</span> ) else (<div></div>)
} }
) )
}; };
...@@ -487,11 +509,11 @@ declare function analysis:tei-header ...@@ -487,11 +509,11 @@ declare function analysis:tei-header
case text() return ( case text() return (
$node $node
) )
case element(tei:teiHeader) return ( case element(tei:teiHeader) return (
analysis:tei-header($node/node()) analysis:tei-header($node/node())
) )
case element(tei:fileDesc) return ( case element(tei:fileDesc) return (
analysis:tei-header($node/node()) analysis:tei-header($node/node())
) )
...@@ -499,7 +521,7 @@ declare function analysis:tei-header ...@@ -499,7 +521,7 @@ declare function analysis:tei-header
case element(tei:titleStmt) return ( case element(tei:titleStmt) return (
analysis:tei-header($node/node()) analysis:tei-header($node/node())
) )
case element(tei:title) return ( case element(tei:title) return (
if ($node[@level]) then ( if ($node[@level]) then (
<div class="value"> <div class="value">
...@@ -518,13 +540,13 @@ declare function analysis:tei-header ...@@ -518,13 +540,13 @@ declare function analysis:tei-header
declare function analysis:marker-report declare function analysis:marker-report
( $doc ) as item() { ( $doc ) as item() {
let $markers := analysis:get-rdg-markers($doc) let $markers := analysis:get-rdg-markers($doc)
let $dif := data($markers//open/@count) - data($markers//close/@count) let $dif := data($markers//open/@count) - data($markers//close/@count)
return return
if ($dif = 0) then ( if ($dif = 0) then (
<okay count="{data($markers//open/@count)}" /> <okay count="{data($markers//open/@count)}" />
) )
else ( else (
<error dif="{$dif}">{analysis:check-marker($markers)}</error> <error dif="{$dif}">{analysis:check-marker($markers)}</error>
) )
...@@ -533,7 +555,7 @@ declare function analysis:marker-report ...@@ -533,7 +555,7 @@ declare function analysis:marker-report
declare function analysis:check-marker declare function analysis:check-marker
( $markers ) as item()* { ( $markers ) as item()* {
let $open := $markers//open/node() let $open := $markers//open/node()
let $close := $markers//close/node() let $close := $markers//close/node()
let $dif := data($markers//open/@count) - data($markers//close/@count) let $dif := data($markers//open/@count) - data($markers//close/@count)
...@@ -558,7 +580,7 @@ declare function analysis:check-marker ...@@ -558,7 +580,7 @@ declare function analysis:check-marker
declare function analysis:get-rdg-markers declare function analysis:get-rdg-markers
( $doc ) as item()* { ( $doc ) as item()* {
let $open := $doc//tei:rdgMarker[@mark = "open"] let $open := $doc//tei:rdgMarker[@mark = "open"]
let $close := $doc//tei:rdgMarker[@mark = "close"] let $close := $doc//tei:rdgMarker[@mark = "close"]
return return
......
xquery version "3.1"; xquery version "3.1";
(:
: Copyright (c) 2018 Uwe Sikora
: Copyright (c) 2018–2019 Michelle Weidling
: Copyright (c) 2020 Stefan Hynek
:
: This file is part of intermediate-format.
:
: intermediate-format is free software: you can redistribute it and/or modify
: it under the terms of the GNU General Public License as published by
: the Free Software Foundation, either version 3 of the License, or
: (at your option) any later version.
:
: intermediate-format is distributed in the hope that it will be useful,
: but WITHOUT ANY WARRANTY; without even the implied warranty of
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: GNU General Public License for more details.
:
: You should have received a copy of the GNU General Public License
: along with intermediate-format. If not, see <https://www.gnu.org/licenses/>.
:)
module namespace app="http://bdn-edition.de/intermediate_format/templates"; module namespace app="http://bdn-edition.de/intermediate_format/templates";
declare namespace tei = "http://www.tei-c.org/ns/1.0"; declare namespace tei = "http://www.tei-c.org/ns/1.0";
...@@ -13,10 +34,10 @@ import module namespace console="http://exist-db.org/xquery/console"; ...@@ -13,10 +34,10 @@ import module namespace console="http://exist-db.org/xquery/console";
(:~ (:~
: This is a sample templating function. It will be called by the templating module if : This is a sample templating function. It will be called by the templating module if
: it encounters an HTML element with an attribute: data-template="app:test" or class="app:test" (deprecated). : it encounters an HTML element with an attribute: data-template="app:test" or class="app:test" (deprecated).
: The function has to take 2 default parameters. Additional parameters are automatically mapped to : The function has to take 2 default parameters. Additional parameters are automatically mapped to
: any matching request or function parameter. : any matching request or function parameter.
: :
: @param $node the HTML node with the attribute which triggered this call : @param $node the HTML node with the attribute which triggered this call
: @param $model a map containing arbitrary data - used to pass information between template calls : @param $model a map containing arbitrary data - used to pass information between template calls
:) :)
...@@ -27,12 +48,12 @@ declare function app:test($node as node(), $model as map(*)) { ...@@ -27,12 +48,12 @@ declare function app:test($node as node(), $model as map(*)) {
(: (:
declare declare
%templates:wrap %templates:wrap
%templates:default("doc", "/db/apps/interformat/data/samples/samples.xml") %templates:default("doc", "/db/apps/interformat/data/samples/samples.xml")
function app:present($node as node(), $model as map(*), $doc) { function app:present($node as node(), $model as map(*), $doc) {
<div class="serialisation"> <div class="serialisation">
{ {
let $nodes := doc($doc) let $nodes := doc($doc)
let $preprocessed-data := pre:preprocessing($nodes/tei:TEI) let $preprocessed-data := pre:preprocessing($nodes/tei:TEI)
let $intermediate-format := ident:walk($preprocessed-data, ()) let $intermediate-format := ident:walk($preprocessed-data, ())
...@@ -44,15 +65,15 @@ function app:present($node as node(), $model as map(*), $doc) { ...@@ -44,15 +65,15 @@ function app:present($node as node(), $model as map(*), $doc) {
:) :)
declare declare
%templates:wrap %templates:wrap
%templates:default("doc", "/db/apps/interformat/data/samples/samples.xml") %templates:default("doc", "/db/apps/interformat/data/samples/samples.xml")
function app:app-view($node as node(), $model as map(*), $doc) { function app:app-view($node as node(), $model as map(*), $doc) {
<div class="apps"> <div class="apps">
{ {
for $app at $nr in doc($doc)//tei:app[not(@type='structural-variance')] for $app at $nr in doc($doc)//tei:app[not(@type='structural-variance')]
let $readings := $app/node() let $readings := $app/node()
return return
<div class="panel panel-info"> <div class="panel panel-info">
<div class="panel-heading"> <div class="panel-heading">
<ul style="padding-left: 0px; list-style-type: none;"> <ul style="padding-left: 0px; list-style-type: none;">
...@@ -69,21 +90,21 @@ function app:app-view($node as node(), $model as map(*), $doc) { ...@@ -69,21 +90,21 @@ function app:app-view($node as node(), $model as map(*), $doc) {
}; };
declare declare
%templates:wrap %templates:wrap
%templates:default("doc", "/db/apps/interformat/data/samples/samples.xml") %templates:default("doc", "/db/apps/interformat/data/samples/samples.xml")
function app:present($node as node(), $model as map(*), $doc) { function app:present($node as node(), $model as map(*), $doc) {
<div class="serialisation"> <div class="serialisation">
{ {
let $nodes := doc($doc)/tei:TEI let $nodes := doc($doc)/tei:TEI
return return
analysis:tei-body($nodes//tei:text) analysis:tei-body($nodes//tei:text)
} }
</div> </div>
}; };
declare declare
%templates:wrap %templates:wrap
%templates:default("doc", "/db/apps/interformat/data/samples/samples.xml") %templates:default("doc", "/db/apps/interformat/data/samples/samples.xml")
function app:tei-metadata($node as node(), $model as map(*), $doc) { function app:tei-metadata($node as node(), $model as map(*), $doc) {
...@@ -99,7 +120,7 @@ function app:tei-metadata($node as node(), $model as map(*), $doc) { ...@@ -99,7 +120,7 @@ function app:tei-metadata($node as node(), $model as map(*), $doc) {
}; };
declare declare
%templates:wrap %templates:wrap
%templates:default("collection", "/db/apps/interformat/data/output") %templates:default("collection", "/db/apps/interformat/data/output")
function app:list-output-resources($node as node(), $model as map(*), $collection) { function app:list-output-resources($node as node(), $model as map(*), $collection) {
...@@ -127,7 +148,7 @@ function app:list-output-resources($node as node(), $model as map(*), $collectio ...@@ -127,7 +148,7 @@ function app:list-output-resources($node as node(), $model as map(*), $collectio
if ($analyse-markers[self::okay]) then ( if ($analyse-markers[self::okay]) then (
<span style="color: green">&#10004;</span>, <span style="color: green">&#10004;</span>,
<span style="padding-left: 5px">{data($analyse-markers/@count)}</span> <span style="padding-left: 5px">{data($analyse-markers/@count)}</span>
) )
else ( else (
<span style="color: red">&#10007;</span>, <span style="color: red">&#10007;</span>,
<span style="padding-left: 5px">error</span>, <span style="padding-left: 5px">error</span>,
...@@ -139,12 +160,12 @@ function app:list-output-resources($node as node(), $model as map(*), $collectio ...@@ -139,12 +160,12 @@ function app:list-output-resources($node as node(), $model as map(*), $collectio
let $wit := data($error/@wit) let $wit := data($error/@wit)
let $ref := data($error/@ref) let $ref := data($error/@ref)
let $context := data($error/@context) let $context := data($error/@context)
return return
<li>missing <strong>{$type}</strong> marker for wit "{$wit}" in reading "{$context}" (<i>{$ref}</i>)</li> <li>missing <strong>{$type}</strong> marker for wit "{$wit}" in reading "{$context}" (<i>{$ref}</i>)</li>
} }
</ul> </ul>
) )
} }
</td> </td>
<td> <td>
......
xquery version "3.0"; xquery version "3.0";
(:
: Copyright (c) 2018 Uwe Sikora
: Copyright (c) 2018–2019 Michelle Weidling
: Copyright (c) 2020 Stefan Hynek
:
: This file is part of intermediate-format.
:
: intermediate-format is free software: you can redistribute it and/or modify
: it under the terms of the GNU General Public License as published by
: the Free Software Foundation, either version 3 of the License, or
: (at your option) any later version.
:
: intermediate-format is distributed in the hope that it will be useful,
: but WITHOUT ANY WARRANTY; without even the implied warranty of
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: GNU General Public License for more details.
:
: You should have received a copy of the GNU General Public License
: along with intermediate-format. If not, see <https://www.gnu.org/licenses/>.
:)
(:~ (:~
: A set of helper functions to access the application context from : A set of helper functions to access the application context from
: within a module. : within a module.
......
xquery version "3.1"; xquery version "3.1";
(:~
(:
: Copyright (c) 2018 Uwe Sikora
: Copyright (c) 2018–2019 Michelle Weidling
: Copyright (c) 2020 Stefan Hynek
:
: This file is part of intermediate-format.
:
: intermediate-format is free software: you can redistribute it and/or modify
: it under the terms of the GNU General Public License as published by
: the Free Software Foundation, either version 3 of the License, or
: (at your option) any later version.
:
: intermediate-format is distributed in the hope that it will be useful,
: but WITHOUT ANY WARRANTY; without even the implied warranty of
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: GNU General Public License for more details.
:
: You should have received a copy of the GNU General Public License
: along with intermediate-format. If not, see <https://www.gnu.org/licenses/>.
:)
(:~
: INTERMEDIATEFORMAT Utils Module ("ifutils", "http://bdn.edition.de/intermediate_format/utils") : INTERMEDIATEFORMAT Utils Module ("ifutils", "http://bdn.edition.de/intermediate_format/utils")
: ******************************************************************************************* : *******************************************************************************************
: This modules defines helpfull functions used all over the app : This modules defines helpfull functions used all over the app
: :
: @version 1.0 (2018-02-23) : @version 1.0 (2018-02-23)
: @status developing : @status developing
: @author Uwe Sikora : @author Uwe Sikora
...@@ -16,91 +38,91 @@ import module namespace http = "http://expath.org/ns/http-client"; ...@@ -16,91 +38,91 @@ import module namespace http = "http://expath.org/ns/http-client";
(:############################# Modules Functions #############################:) (:############################# Modules Functions #############################:)
(:~ (:~
: ifutils:exists() : ifutils:exists()
: This function checks if a resource exists in a directory : This function checks if a resource exists in a directory
: :
: @param $uri the uri of a resource : @param $uri the uri of a resource
: @return xs:boolean ('true' else 'false') : @return xs:boolean ('true' else 'false')
: :
: @version 1.0 (2018-03-23) : @version 1.0 (2018-03-23)
: @status working : @status working
: @author Uwe Sikora : @author Uwe Sikora
:) :)
declare function ifutils:exists declare function ifutils:exists
( $uri as xs:string ) { ( $uri as xs:string ) {
let $files := (for $i in collection(replace($uri, '(.+)/.+$', '$1')) return base-uri($i)) let $files := (for $i in collection(replace($uri, '(.+)/.+$', '$1')) return base-uri($i))
return $uri = $files return $uri = $files
}; };
(:~ (:~
: ifutils:get-resource() : ifutils:get-resource()
: This function gets a resource from the database or from a online source : This function gets a resource from the database or from a online source
: :
: @param $uri the uri of a resource : @param $uri the uri of a resource
: @return document-node : @return document-node
: :
: @version 1.0 (2018-03-23) : @version 1.0 (2018-03-23)
: @status developing : @status developing
: @author Uwe Sikora : @author Uwe Sikora
:) :)
declare function ifutils:get-resource declare function ifutils:get-resource
( $uri as xs:string ) { ( $uri as xs:string ) {
let $resource := ( let $resource := (
if ( ifutils:exists($uri) ) then ( if ( ifutils:exists($uri) ) then (
doc($uri) doc($uri)
) )
else () else ()
) )
return $resource return $resource
}; };
(:~ (:~
: ifutils:ls() : ifutils:ls()
: This function lists all documents from a collection : This function lists all documents from a collection
: :
: @param $collection the path of a collection : @param $collection the path of a collection
: @return all document-base-uris from the collection : @return all document-base-uris from the collection
: :
: @version 1.0 (2018-03-23) : @version 1.0 (2018-03-23)
: @status developing : @status developing
: @author Uwe Sikora : @author Uwe Sikora
:) :)
declare function ifutils:ls declare function ifutils:ls
( $collection as xs:string ) { ( $collection as xs:string ) {
for $doc in collection($collection) for $doc in collection($collection)
return base-uri($doc) return base-uri($doc)
}; };
(:~ (:~
: ifutils:request() : ifutils:request()
: This http wrapper function models a request : This http wrapper function models a request
: :
: @param $uri the uri of a resource : @param $uri the uri of a resource
: @param $method the http method : @param $method the http method
: @param $username the username : @param $username the username
: @param $password the password : @param $password the password
: @return http-response : @return http-response
: :
: @version 1.0 (2018-03-23) : @version 1.0 (2018-03-23)
: @status developing : @status developing
: @author Uwe Sikora : @author Uwe Sikora
:) :)
declare function ifutils:request declare function ifutils:request
($url as xs:string, $method as xs:string, $username as xs:string?, $password as xs:string? ) { ($url as xs:string, $method as xs:string, $username as xs:string?, $password as xs:string? ) {
let $req := <http:request href="{ $url }" let $req := <http:request href="{ $url }"
method="{ $method }" method="{ $method }"
username="{ $username }" username="{ $username }"
password="{ $password }" password="{ $password }"
auth-method="basic" auth-method="basic"
send-authorization="true"/> send-authorization="true"/>
return http:send-request($req) return http:send-request($req)
}; };
\ No newline at end of file
xquery version "3.0"; xquery version "3.0";
(:
: Copyright (c) 2018 Uwe Sikora
: Copyright (c) 2018–2019 Michelle Weidling
: Copyright (c) 2020 Stefan Hynek
:
: This file is part of intermediate-format.
:
: intermediate-format is free software: you can redistribute it and/or modify
: it under the terms of the GNU General Public License as published by
: the Free Software Foundation, either version 3 of the License, or
: (at your option) any later version.
:
: intermediate-format is distributed in the hope that it will be useful,
: but WITHOUT ANY WARRANTY; without even the implied warranty of
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: GNU General Public License for more details.
:
: You should have received a copy of the GNU General Public License
: along with intermediate-format. If not, see <https://www.gnu.org/licenses/>.
:)
(:~ (:~
: IDENTIFICATION Module ("ident", "http://bdn.edition.de/intermediate_format/identification") : IDENTIFICATION Module ("ident", "http://bdn.edition.de/intermediate_format/identification")
: ******************************************************************************************* : *******************************************************************************************
......
xquery version "3.1";
(:
: Copyright (c) 2018 Uwe Sikora
: Copyright (c) 2018–2019 Michelle Weidling
: Copyright (c) 2020 Stefan Hynek
:
: This file is part of intermediate-format.
:
: intermediate-format is free software: you can redistribute it and/or modify
: it under the terms of the GNU General Public License as published by
: the Free Software Foundation, either version 3 of the License, or
: (at your option) any later version.
:
: intermediate-format is distributed in the hope that it will be useful,
: but WITHOUT ANY WARRANTY; without even the implied warranty of
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: GNU General Public License for more details.
:
: You should have received a copy of the GNU General Public License
: along with intermediate-format. If not, see <https://www.gnu.org/licenses/>.
:)
(:~ (:~
: ifweb.xql offers a simple interface for creating the website specific BdN : ifweb.xql offers a simple interface for creating the website specific BdN
: intermediate format of a given resource. : intermediate format of a given resource.
...@@ -6,16 +29,15 @@ ...@@ -6,16 +29,15 @@
: @version 1.0 : @version 1.0
: :
:) :)
xquery version "3.1";
module namespace ifweb="http://bdn-edition.de/intermediate_format/ifweb"; module namespace ifweb="http://bdn-edition.de/intermediate_format/ifweb";
declare namespace tei = "http://www.tei-c.org/ns/1.0"; declare namespace tei = "http://www.tei-c.org/ns/1.0";
import module namespace console="http://exist-db.org/xquery/console"; import module namespace console="http://exist-db.org/xquery/console";
import module namespace pre="http://bdn-edition.de/intermediate_format/preprocessing" at "xmldb:exist:///db/apps/interformat/modules/intermediate_format/preprocessing.xqm"; import module namespace pre="http://bdn-edition.de/intermediate_format/preprocessing" at "preprocessing.xqm";
import module namespace ident = "http://bdn-edition.de/intermediate_format/identification" at "xmldb:exist:///db/apps/interformat/modules/intermediate_format/identification.xqm"; import module namespace ident = "http://bdn-edition.de/intermediate_format/identification" at "identification.xqm";
import module namespace config = "http://bdn-edition.de/intermediate_format/config" at "xmldb:exist:///db/apps/interformat/modules/config.xqm"; import module namespace config = "http://bdn-edition.de/intermediate_format/config" at "../config.xqm";
declare option exist:serialize "method=xml media-type=text/xml omit-xml-declaration=no indent=no"; declare option exist:serialize "method=xml media-type=text/xml omit-xml-declaration=no indent=no";
......
xquery version "3.0"; xquery version "3.0";
(:
: Copyright (c) 2018 Uwe Sikora
: Copyright (c) 2018–2019 Michelle Weidling
: Copyright (c) 2020 Stefan Hynek
:
: This file is part of intermediate-format.
:
: intermediate-format is free software: you can redistribute it and/or modify
: it under the terms of the GNU General Public License as published by
: the Free Software Foundation, either version 3 of the License, or
: (at your option) any later version.
:
: intermediate-format is distributed in the hope that it will be useful,
: but WITHOUT ANY WARRANTY; without even the implied warranty of
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: GNU General Public License for more details.
:
: You should have received a copy of the GNU General Public License
: along with intermediate-format. If not, see <https://www.gnu.org/licenses/>.
:)
(:~ (:~
: MARKERSET Module ("markerset", "http://bdn.edition.de/intermediate_format/markerset") : MARKERSET Module ("markerset", "http://bdn.edition.de/intermediate_format/markerset")
: ******************************************************************************************* : *******************************************************************************************
......