From ce041974422a22da9dbd77d974e4ff88468313f9 Mon Sep 17 00:00:00 2001 From: Wolfgang Meier Date: Sun, 20 Aug 2023 18:37:09 +0200 Subject: [PATCH] Document URL routing: small changes --- data/doc/documentation.xml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/data/doc/documentation.xml b/data/doc/documentation.xml index 6dfc6513..b234e822 100644 --- a/data/doc/documentation.xml +++ b/data/doc/documentation.xml @@ -3631,8 +3631,12 @@ declare function pmf:code($config as map(*), $node as element(), $class as xs:st Both examples need two route definitions: the first corresponding to the root page displayed, i.e. if the user has not selected a chapter or headword, the second to represent the detail view of a chapter or headword. For the documentation, modules/custom-api.json thus has configurations for /documentation as well as /documentation/{id}. In both cases we simply copied and modified the configuration for the standard path, i.e. "/{docid}", from modules/lib/api.json. The default endpoint takes various parameter, including two required ones: docid for the path to the TEI document, and template to specify the HTML template to use. For the documentation those will always be the same, i.e. doc/documentation.xml and pages/documentation.html, so we can pass them as a default value. This way we can reuse the existing operation (vapi:view) and don't have to write a custom handler function in XQuery! - We also add two parameters, id and base. The first will take the of the chapter we're looking for. id is one of the standard parameters picked up by the pb-view in the HTML when loading the actual content to display. base will be used in the template to set the HTML base tag in the HTML head. This is required to tell the browser where images and other resources should be loaded from. - The complete definition looks like this: + We also add two parameters, id and base. The first will take the of the chapter we're looking for. id is one of the standard parameters picked up by the pb-view in the HTML when loading the actual content to display. base will be used in the template to set the HTML base tag in the HTML head. This is required to tell the browser where images and other resources should be loaded from: + + + ... +]]> + The complete definition of the route in modules/custom-api.json looks like this: