Skip to content

Commit

Permalink
Merge pull request #626 from joewiz/templating
Browse files Browse the repository at this point in the history
Switch to the new templating module, remove shared-resources dependency
  • Loading branch information
line-o authored Jun 12, 2021
2 parents b071189 + d1ddc1a commit 4d06731
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 36 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<project.build.target>1.8</project.build.target>

<exist.version>5.3.0-SNAPSHOT</exist.version>
<shared-resources.version>0.8.4</shared-resources.version>
<templating.version>1.0.2</templating.version>
<node.version>v14.17.0</node.version>
<npm.version>6.14.13</npm.version>

Expand Down Expand Up @@ -290,8 +290,8 @@
<existDbVersion>${exist.version}</existDbVersion>
<packages>
<package>
<abbrev>shared</abbrev>
<version>${shared-resources.version}</version>
<abbrev>templating</abbrev>
<version>${templating.version}</version>
</package>
</packages>
</configuration>
Expand Down
15 changes: 0 additions & 15 deletions src/main/xar-resources/controller.xql
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,6 @@ else
<forward url="{$exist:controller}/modules/view.xql"/>
</error-handler>
</dispatch>

(: Anything with /$shared/ in it points to the eXist main shared-resources app: :)
else
if (contains($exist:path, "/$shared/")) then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="/shared-resources/{substring-after($exist:path, '/$shared/')}"/>
</dispatch>

(: Shared images, css, etc. are contained in the top /resources/ collection. :)
(:else
if (starts-with($exist:path, "/resources/")) then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="{$exist:controller}/resources/{substring-after($exist:path, '/resources/')}"/>
</dispatch>:)

(: Final catch-all: :)
else
<ignore xmlns="http://exist.sourceforge.net/NS/exist">
Expand Down
6 changes: 3 additions & 3 deletions src/main/xar-resources/data/repo/listings/listing-1.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<package xmlns="http://expath.org/ns/pkg" name="http://exist-db.org/apps/doc" abbrev="exist-documentation" version="0.6.1" spec="1.0">
<package xmlns="http://expath.org/ns/pkg" abbrev="exist-documentation" name="http://exist-db.org/apps/doc" spec="1.0" version="5.2.1-SNAPSHOT">
<title>
eXist-db Documentation
</title>
<home>
https://www.github.com/exist-db/documentation
</home>
<dependency processor="http://exist-db.org" semver-min="3.5.0"/>
<dependency package="http://exist-db.org/apps/shared" semver-min="0.4.0"/>
<dependency processor="http://exist-db.org" semver-min="5.3.0-SNAPSHOT"/>
<dependency package="http://exist-db.org/html-templating"/>
</package>
2 changes: 1 addition & 1 deletion src/main/xar-resources/data/repo/listings/listing-2.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<dependency package="http://exist-db.org/apps/shared"/>
<dependency package="http://exist-db.org/html-templating"/>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<dependency package="http://exist-db.org/html-templating" semver-min="1.0.0"/>
<dependency package="http://exist-db.org/html-templating"/>
3 changes: 0 additions & 3 deletions src/main/xar-resources/error-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
<h1>An error has occurred</h1>
<p>An error has been generated by the application.</p>
<pre class="error" data-template="templates:error-description"/>
<div class="source-links">
<p>View source: <a data-template="templates:load-source" href="login.html">this page</a>.</p>
</div>
</div>
2 changes: 1 addition & 1 deletion src/main/xar-resources/modules/app.xql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ xquery version "3.1";

module namespace app = "http://exist-db.org/apps/docs/app";

import module namespace templates = "http://exist-db.org/xquery/templates";
import module namespace templates = "http://exist-db.org/xquery/html-templating";
import module namespace config = "http://exist-db.org/xquery/apps/config" at "config.xqm";

declare namespace expath = "http://expath.org/ns/pkg";
Expand Down
2 changes: 1 addition & 1 deletion src/main/xar-resources/modules/config.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ xquery version "3.0";

module namespace config = "http://exist-db.org/xquery/apps/config";

import module namespace templates = "http://exist-db.org/xquery/templates";
import module namespace templates = "http://exist-db.org/xquery/html-templating";

declare namespace repo = "http://exist-db.org/xquery/repo";
declare namespace expath = "http://expath.org/ns/pkg";
Expand Down
2 changes: 1 addition & 1 deletion src/main/xar-resources/modules/docbook.xql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ xquery version "3.0";
module namespace docbook="http://docbook.org/ns/docbook";

import module namespace config="http://exist-db.org/xquery/apps/config" at "config.xqm";
import module namespace templates="http://exist-db.org/xquery/templates" at "templates.xql";
import module namespace templates="http://exist-db.org/xquery/html-templating";
import module namespace dq="http://exist-db.org/xquery/documentation/search" at "search.xql";

declare namespace db5="http://docbook.org/ns/docbook";
Expand Down
2 changes: 1 addition & 1 deletion src/main/xar-resources/modules/search.xql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import module namespace kwic = "http://exist-db.org/xquery/kwic";
import module namespace util = "http://exist-db.org/xquery/util";

declare namespace db5 = "http://docbook.org/ns/docbook";
declare namespace templates = "http://exist-db.org/xquery/templates";
declare namespace templates = "http://exist-db.org/xquery/html-templating";

declare option exist:serialize "method=html media-type=text/html expand-xincludes=yes";

Expand Down
4 changes: 2 additions & 2 deletions src/main/xar-resources/modules/view.xql
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
xquery version "3.0";

import module namespace templates="http://exist-db.org/xquery/templates";
import module namespace templates="http://exist-db.org/xquery/html-templating";
import module namespace lib="http://exist-db.org/xquery/html-templating/lib";

(: The following modules provide functions which will be called by the templating :)
import module namespace dq="http://exist-db.org/xquery/documentation/search" at "search.xql";
import module namespace docbook="http://docbook.org/ns/docbook" at "docbook.xql";
import module namespace config="http://exist-db.org/xquery/apps/config" at "config.xqm";
import module namespace review="http://exist-db.org/xquery/documentation/review" at "review.xql";
import module namespace site="http://exist-db.org/apps/site-utils";
import module namespace diag="http://exist-db.org/xquery/diagnostics" at "diagnostics.xql";
import module namespace app="http://exist-db.org/apps/docs/app" at "app.xql";

Expand Down
4 changes: 2 additions & 2 deletions src/main/xar-resources/templates/page.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<html>
<html data-template="lib:resolve-apps" data-template-abbrev="dashboard, eXide, fundocs, exist-documentation, demo">

<head>
<title data-template="config:app-title">${project.name}</title>
Expand All @@ -10,7 +10,7 @@
<link rel="stylesheet" type="text/css" href="resources/styles/atom-one-dark.css" />
</head>

<body id="grey-top" class="site:expand-links?base=https://exist-db.org/">
<body id="grey-top" data-template="lib:parse-params" data-template-start="\{">
<div class="grey-bot">
<div class="container" id="main-container">
<div class="row">
Expand Down
5 changes: 4 additions & 1 deletion src/test/mocha/xqSuite.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ describe('running XQsuite test …', function () {
client
.get(runner)
.set('Accept', 'application/json')
.expect('content-type', 'application/json; charset=utf-8')
.expect('content-type', /json/)
.expect(200)
.end(function (err, res) { // eslint-disable-line handle-callback-err
console.info('response body: ' + JSON.stringify(res.body))
if (err) return done(err);
try {
console.group()
console.group()
Expand Down
2 changes: 1 addition & 1 deletion xar-assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<category id="apps">Applications</category>
<category id="doc">Documentation</category>
<dependency processor="http://exist-db.org" semver-min="${exist.version}"/>
<dependency package="http://exist-db.org/apps/shared" semver-min="${shared-resources.version}"/>
<dependency package="http://exist-db.org/html-templating" semver-min="${templating.version}"/>
<prepare>pre-install.xql</prepare>
<changelog>
<change xmlns="http://exist-db.org/xquery/repo" version="5.2.0">
Expand Down

0 comments on commit 4d06731

Please sign in to comment.