Skip to content

Commit

Permalink
Prepare for tei-publisher-lib 4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgangmm committed Oct 11, 2024
1 parent 18f8c1e commit 3992b4b
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 2 deletions.
27 changes: 27 additions & 0 deletions data/doc/documentation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4490,6 +4490,33 @@ declare function config:collection-config($collection as xs:string?, $docUri as
<para>For apps created with TEI Publisher 6 updating to 7 or 8 requires only small modifications.
Migrating from earlier versions, like 4 or 5, requires more effort, and is described in futher
sections.</para>
<section xml:id="upgrade-910">
<title>Upgrading from TEI Publisher 9.0 to 9.1</title>
<para>This bug fix release is mainly relevant for Windows users running eXist-db directly (i.e. not via docker). The biggest change is the upgrade of
<emphasis>tei-publisher-lib</emphasis>: version 4.0.0 of the library introduced the possibility to directly reference variables and functions defined in TEI Publisher's main
configuration module (<filename>modules/config.xqm</filename>). While this is unproblematic in most environments, it causes a silent failure in windows
when compiling an ODD. The underlying reason is that <filename>config.xqm</filename> itself imports a large number of other modules, leading to
recursive imports, which eXist-db is currently unable to resolve properly on Windows. </para>
<para>In general, importing all of <filename>config.xqm</filename> into the ODD generated code is usually unnecessary as most of the settings are not needed and creates an
overhead. Version 4.0.1 of <emphasis>tei-publisher-lib</emphasis> therefore no longer imports <filename>config.xqm</filename> by default. Instead, you can configure the modules to be made
available via <filename>odd/configuration.xml</filename> (or <filename>resources/odd/configuration.xml</filename>). By default, TEI Publisher 9.1 imports the dedicated
<filename>modules/odd-global.xqm</filename>.</para>
<para>To update follow the generic instructions above.</para>
<orderedlist>
<listitem>
<para>If your ODD was using <parameter>$global</parameter> anywhere, copy <filename>modules/odd-global.xqm</filename> from TEI Publisher 9.1 into the corresponding location of your app. Open the
module to check if the settings still match your custom application (e.g. if <parameter>data-root</parameter> is correct).</para>
</listitem>
<listitem>
<para>Change your <filename>resources/odd/configuration.xml</filename> to include the module declaration:</para>
<programlisting language="xml" xml:space="preserve"><![CDATA[<modules>
<!-- Import global variables and functions from modules/odd-global.xqm -->
<module uri="http://e-editiones.org/tei-publisher/odd-global" prefix="global" at="odd-global.xqm"/>
...
</modules>]]></programlisting>
</listitem>
</orderedlist>
</section>
<section xml:id="upgrade-810">
<title>Upgrading from TEI Publisher 8 to 9</title>
<para>To upgrade a custom application generated with TEI Publisher 8 to version 9, we recommend to have the source code of both, TEI Publisher 9 and the
Expand Down
2 changes: 1 addition & 1 deletion modules/lib/api/generate.xql
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ declare function deploy:expand($collection as xs:string, $resource as xs:string,

declare function deploy:store-libs($target as xs:string, $userData as xs:string+, $permissions as xs:string) {
let $path := $config:app-root || "/modules"
for $lib in ("map.xql", "facets.xql", "registers.xql", "annotation-config.xqm", "nlp-config.xqm", "iiif-config.xqm", xmldb:get-child-resources($path)[starts-with(., "navigation")],
for $lib in ("map.xql", "facets.xql", "registers.xql", "annotation-config.xqm", "nlp-config.xqm", "iiif-config.xqm", "odd-global.xqm", xmldb:get-child-resources($path)[starts-with(., "navigation")],
xmldb:get-child-resources($path)[starts-with(., "query")])
return (
xmldb:copy-resource($path, $lib, $target || "/modules", $lib)
Expand Down
31 changes: 31 additions & 0 deletions modules/odd-global.xqm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
xquery version "3.1";

module namespace config="http://e-editiones.org/tei-publisher/odd-global";

(:
Determine the application root collection from the current module load path.
:)
declare variable $config:app-root :=
let $rawPath := system:get-module-load-path()
let $modulePath :=
(: strip the xmldb: part :)
if (starts-with($rawPath, "xmldb:exist://")) then
if (starts-with($rawPath, "xmldb:exist://embedded-eXist-server")) then
substring($rawPath, 36)
else
substring($rawPath, 15)
else
$rawPath
return
substring-before($modulePath, "/modules")
;

(:~
: The root of the collection hierarchy containing data.
:)
declare variable $config:data-root := $config:app-root || "/data";

(:~
: The root of the collection hierarchy containing registers data.
:)
declare variable $config:register-root := $config:data-root || "/registers";
2 changes: 2 additions & 0 deletions odd/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
The "odd" is defined by its name, without the .odd suffix.
-->
<modules>
<!-- Import global variables and functions from modules/odd-global.xqm -->
<module uri="http://e-editiones.org/tei-publisher/odd-global" prefix="global" at="odd-global.xqm"/>
<!-- General latex extension functions -->
<output mode="latex">
<property name="class">"article"</property>
Expand Down
2 changes: 2 additions & 0 deletions templates/basic/resources/odd/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
to the modules/ collection.
-->
<modules>
<!-- Import global variables and functions from modules/odd-global.xqm -->
<module uri="http://e-editiones.org/tei-publisher/odd-global" prefix="global" at="odd-global.xqm"/>
<!-- General latex extension functions -->
<!--output mode="latex">
<property name="class">"article"</property>
Expand Down
1 change: 0 additions & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ <h1 class="tp-title">The Instant Publishing Toolbox<small data-template="pages:v
<div id="document-list">
<pb-paginate id="paginate" per-page="10" range="5" subscribe="search" emit="search"></pb-paginate>
<pb-load url="api/collection/{collection}" expand="" emit="search"></pb-load>
<!--pb-browse url="api/collection" emit="search"></pb-browse-->
</div>
</div>
</div>
Expand Down

0 comments on commit 3992b4b

Please sign in to comment.