Skip to content

Commit 0d7f107

Browse files
authored
Merge pull request #1086 from line-o/deps/templating
2 parents 23c31e6 + a395b5d commit 0d7f107

File tree

3 files changed

+27
-19
lines changed

3 files changed

+27
-19
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<project.build.target>1.8</project.build.target>
5050

5151
<exist.version>${project.version}</exist.version>
52-
<templating.version>1.1.0</templating.version>
52+
<templating.version>1.2.0</templating.version>
5353
<node.version>v18.20.5</node.version>
5454
<npm.version>10.8.2</npm.version>
5555

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
xquery version "3.0";
1+
xquery version "3.1";
2+
23

34
import module namespace templates="http://exist-db.org/xquery/html-templating";
45
import module namespace lib="http://exist-db.org/xquery/html-templating/lib";
@@ -11,19 +12,26 @@ import module namespace review="http://exist-db.org/xquery/documentation/review"
1112
import module namespace diag="http://exist-db.org/xquery/diagnostics" at "diagnostics.xql";
1213
import module namespace app="http://exist-db.org/apps/docs/app" at "app.xql";
1314

14-
declare option exist:serialize "method=html5 media-type=text/html";
1515

16-
let $config := map {
16+
declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization";
17+
18+
declare option output:method "html5";
19+
declare option output:media-type "text/html";
20+
21+
declare function local:lookup ($functionName as xs:string, $arity as xs:integer) {
22+
function-lookup(xs:QName($functionName), $arity)
23+
};
24+
25+
declare variable $local:templating-configuration := map {
26+
$templates:CONFIG_FILTER_ATTRIBUTES : true(),
27+
$templates:CONFIG_USE_CLASS_SYNTAX : false(),
1728
$templates:CONFIG_APP_ROOT : $config:app-root,
1829
$templates:CONFIG_STOP_ON_ERROR : true()
19-
}
20-
let $lookup := function($functionName as xs:string, $arity as xs:integer) {
21-
try {
22-
function-lookup(xs:QName($functionName), $arity)
23-
} catch * {
24-
()
25-
}
26-
}
27-
let $content := request:get-data()
28-
return
29-
templates:apply($content, $lookup, (), $config)
30+
};
31+
32+
templates:apply(
33+
request:get-data(),
34+
local:lookup#2,
35+
(),
36+
$local:templating-configuration
37+
)

src/main/xar-resources/search.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
<div class="row mb-3">
55
<label class="col-form-label col-md-2 col-xl-1" for="inputSearch">Search for</label>
66
<div class="col-md-10 col-xl-5">
7-
<input class="form-control templates:form-control" id="inputSearch" name="q" type="text"/>
7+
<input class="form-control" data-template="templates:form-control" id="inputSearch" name="q" type="text"/>
88
</div>
99
<label class="col-form-label col-md-2 col-xl-1" for="field">In</label>
1010
<div class="col-md-4 col-xl-2">
11-
<select class="form-select templates:form-control" name="field">
11+
<select class="form-select" data-template="templates:form-control" name="field">
1212
<option selected="selected" value="all">All Contents</option>
1313
<option value="title">Headings Only</option>
1414
</select>
1515
</div>
1616
<label class="col-form-label col-md-2 col-xl-1" for="view">Display as</label>
1717
<div class="col-md-4 col-xl-2">
18-
<select class="form-select templates:form-control" name="view">
18+
<select class="form-select" data-template="templates:form-control" name="view">
1919
<option selected="selected" value="summary">Summary</option>
2020
<option value="kwic">Concordance</option>
2121
</select>
@@ -31,7 +31,7 @@
3131
</div>
3232
</form>
3333
<div class="row" id="content">
34-
<div class="dq:query"></div>
34+
<div data-template="dq:query"></div>
3535
</div>
3636
</div>
3737
</div>

0 commit comments

Comments
 (0)