From 2ef1cc0d8b8ec29801e14bcad7c048ba222a8664 Mon Sep 17 00:00:00 2001 From: Wolfgang Meier Date: Tue, 14 May 2024 18:03:52 +0200 Subject: [PATCH] Add parameter "serialize" to /api/parts endpoint to switch between HTML5 and XML serialization for content --- modules/lib/api.json | 31 ++++++++++++++++++++++++++++++- modules/lib/api/document.xql | 6 ++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/modules/lib/api.json b/modules/lib/api.json index 4909cc51..b1d21997 100644 --- a/modules/lib/api.json +++ b/modules/lib/api.json @@ -1299,6 +1299,16 @@ "type": "string" } }, + { + "name": "serialize", + "in": "query", + "schema": { + "type": "string", + "enum": ["xml", "html5"], + "default": "html5" + }, + "description": "should HTML content be rendered as HTML5 or XML?" + }, { "name": "If-Modified-Since", "in": "header", @@ -3421,7 +3431,26 @@ } } } - } + }, + "/sitemap.xml": { + "get": { + "description": "Return generated sitemap", + "operationId": "sitemap:sitemap", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/xml": { + "schema": { + "type": "string" + } + } + } + } + } + } + } }, "security": [ { diff --git a/modules/lib/api/document.xql b/modules/lib/api/document.xql index 91b92f9a..8d211d36 100644 --- a/modules/lib/api/document.xql +++ b/modules/lib/api/document.xql @@ -522,12 +522,14 @@ declare function dapi:get-fragment($request as map(*), $docs as node()*, $path a "content": serialize($transformed?content, no - html5 + {$request?parameters?serialize} + yes ), "footnotes": serialize($transformed?footnotes, no - html5 + {$request?parameters?serialize} + yes ), "userParams": $userParams,