Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 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>${project.version}</exist.version>
<templating.version>1.1.0</templating.version>
<templating.version>1.2.0</templating.version>
<node.version>v18.20.5</node.version>
<npm.version>10.8.2</npm.version>

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


import module namespace templates="http://exist-db.org/xquery/html-templating";
import module namespace lib="http://exist-db.org/xquery/html-templating/lib";
Expand All @@ -11,19 +12,26 @@ import module namespace review="http://exist-db.org/xquery/documentation/review"
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";

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

let $config := map {
declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization";

declare option output:method "html5";
declare option output:media-type "text/html";

declare function local:lookup ($functionName as xs:string, $arity as xs:integer) {
function-lookup(xs:QName($functionName), $arity)
};

declare variable $local:templating-configuration := map {
$templates:CONFIG_FILTER_ATTRIBUTES : true(),
$templates:CONFIG_USE_CLASS_SYNTAX : false(),
$templates:CONFIG_APP_ROOT : $config:app-root,
$templates:CONFIG_STOP_ON_ERROR : true()
}
let $lookup := function($functionName as xs:string, $arity as xs:integer) {
try {
function-lookup(xs:QName($functionName), $arity)
} catch * {
()
}
}
let $content := request:get-data()
return
templates:apply($content, $lookup, (), $config)
};

templates:apply(
request:get-data(),
local:lookup#2,
(),
$local:templating-configuration
)
8 changes: 4 additions & 4 deletions src/main/xar-resources/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
<div class="row mb-3">
<label class="col-form-label col-md-2 col-xl-1" for="inputSearch">Search for</label>
<div class="col-md-10 col-xl-5">
<input class="form-control templates:form-control" id="inputSearch" name="q" type="text"/>
<input class="form-control" data-template="templates:form-control" id="inputSearch" name="q" type="text"/>
</div>
<label class="col-form-label col-md-2 col-xl-1" for="field">In</label>
<div class="col-md-4 col-xl-2">
<select class="form-select templates:form-control" name="field">
<select class="form-select" data-template="templates:form-control" name="field">
<option selected="selected" value="all">All Contents</option>
<option value="title">Headings Only</option>
</select>
</div>
<label class="col-form-label col-md-2 col-xl-1" for="view">Display as</label>
<div class="col-md-4 col-xl-2">
<select class="form-select templates:form-control" name="view">
<select class="form-select" data-template="templates:form-control" name="view">
<option selected="selected" value="summary">Summary</option>
<option value="kwic">Concordance</option>
</select>
Expand All @@ -31,7 +31,7 @@
</div>
</form>
<div class="row" id="content">
<div class="dq:query"></div>
<div data-template="dq:query"></div>
</div>
</div>
</div>