Commit 362e419d authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

Merge branch 'feature/#106-transform-single-nb-to-et' into 'develop'

Add single transformation for ET, extend logging

Closes #106

See merge request !44
parents ccd187eb 6695a099
......@@ -13,6 +13,7 @@ xquery version "3.1";
module namespace etTransfo="http://fontane-nb.dariah.eu/etTransfo";
declare namespace err="http://www.w3.org/2005/xqt-errors";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace xi="http://www.w3.org/2001/XInclude";
......@@ -60,6 +61,32 @@ declare function etTransfo:complete() {
etTransfo:report-errors()
};
(:~
: A function to trigger the creation of the edited text for a single notebook.
: Mainly used for parallel creation of the notebooks.
:
: @param $uri The notebook's URI, e.g. "16b00" :)
declare function etTransfo:transform-single-nb($uri as xs:string) as xs:string* {
let $log := util:log-system-out("Start creating edited text for " || $uri)
let $log := etTransfo:create-log($uri)
let $tei := doc($config:data-root || "/data/" || $uri || ".xml")//tei:TEI
let $updated-notebook :=
element tei:TEI {
attribute id {$uri},
$tei/@*,
$tei/*
}
return
(try {
etTransfo:transform-tei($updated-notebook, $log)
} catch * {
etTransfo:add-log-entry($log, "ETTRANSFO08: Couldn't transform TEI. ")
},
etTransfo:tidy-logs(),
etTransfo:report-errors())
};
(:~
: Resolves all XIncludes in a given case file and copies all notebooks belonging to a case into one file.
......@@ -175,28 +202,32 @@ declare function etTransfo:transform-tei($tei as element(tei:TEI), $log as xs:st
try {
prepCom:main($sorted, $tei/@id)
} catch * {
etTransfo:add-log-entry($log, "ETTRANSFO10: Error while preparing commentary for this notebook. ")
etTransfo:add-log-entry($log, "ETTRANSFO10: Error while preparing commentary for this notebook. Reason: 
" ||
concat("[", $err:line-number, ": ", $err:column-number, "] Error ", $err:code, ": ", $err:description))
}
let $transform-to-interform :=
try {
fontaneSimple:main($prepare-comment, $tei/@id, $log)
} catch * {
etTransfo:add-log-entry($log, "ETTRANSFO11: Error while transforming this notebook to an intermediate format. ")
etTransfo:add-log-entry($log, "ETTRANSFO11: Error while transforming this notebook to an intermediate format. Reason: 
" ||
concat("[", $err:line-number, ": ", $err:column-number, "] Error ", $err:code, ": ", $err:description))
}
let $tidy-interform :=
try {
tidySimple:main($transform-to-interform, $tei/@id)
} catch * {
etTransfo:add-log-entry($log, "ETTRANSFO12: Error while tidying up the intermediate format for this notebook. ")
etTransfo:add-log-entry($log, "ETTRANSFO12: Error while tidying up the intermediate format for this notebook. Reason: 
" ||
concat("[", $err:line-number, ": ", $err:column-number, "] Error ", $err:code, ": ", $err:description))
}
return
try {
simple2xhtml:main($tidy-interform, $tei/@id)
} catch * {
etTransfo:add-log-entry($log, "ETTRANSFO13: Error while creating XHTML for this notebook. ")
etTransfo:add-log-entry($log, "ETTRANSFO13: Error while creating XHTML for this notebook. Reason: 
" ||
concat("[", $err:line-number, ": ", $err:column-number, "] Error ", $err:code, ": ", $err:description))
}
};
......
Supports Markdown
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