Skip to content

eXist-db/templating

templating

License GitHub release exist-db CI Coverage percentage

eXist HTML Templating Library

This repository hosts the HTML templating library for eXist, which was previously part of the shared-resources package. shared-resources is now deprecated and users should upgrade their code. The new package intends to be backwards compatible: the namespace URI of the module has changed to avoid conflicts, but existing template functions will continue to work.

Documentation

A detailed documentation for this package can be found in the eXist-db documentation app.

Upgrading from shared-resources

  1. change any dependency on shared-resources in your expath-pkg.xml to point to this package:

    <dependency package="http://exist-db.org/html-templating" semver-min="1.0.0"/>
  2. update the module URI for any imports of the templating module. The new URI is:

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

    New standard templating functions will go into a separate module, so you may want to add the following import in addition to the one above, which will give you access to the lib:parse-params template function (and others in the future):

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

Requirements

  • exist-db version: 5.2.0 or greater

  • node version: 12.x (for building from source)

Installation

  1. Install the eXist-db HTML Templating Library package from eXist's package repository via the dashboard, or download the templating-1.0.0.xar file from GitHub releases page.

  2. Open the dashboard of your eXist-db instance and click on package manager.

    1. Click on the add package symbol in the upper left corner and select the .xar file you just downloaded.
  3. You have successfully installed templating into exist.

Building from source

  1. Download, fork or clone this GitHub repository
  2. Calling npm start in your CLI will install required dependencies from npm and create a .xar:
cd templating
npm start

To install it, follow the instructions above.

Running Tests

This app uses mochajs as a test-runner. To run the tests type:

npm test

This will automatically build and install the library plus a test application into your local eXist, assuming it can be reached on http://localhost:8080/exist. If this is not the case, edit .existdb.json and change the properties for the localhost server to match your setup.

Contributing

You can take a look at the Contribution guidelines for this project

License

LGPL-2.1 Copyright (C) 2001 The eXist-db Authors