Skip to content

Commit

Permalink
Add parameter "serialize" to /api/parts endpoint to switch between HT…
Browse files Browse the repository at this point in the history
…ML5 and XML serialization for content
  • Loading branch information
wolfgangmm committed May 14, 2024
1 parent a1ba6f9 commit 2ef1cc0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
31 changes: 30 additions & 1 deletion modules/lib/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": [
{
Expand Down
6 changes: 4 additions & 2 deletions modules/lib/api/document.xql
Original file line number Diff line number Diff line change
Expand Up @@ -522,12 +522,14 @@ declare function dapi:get-fragment($request as map(*), $docs as node()*, $path a
"content": serialize($transformed?content,
<output:serialization-parameters xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization">
<output:indent>no</output:indent>
<output:method>html5</output:method>
<output:method>{$request?parameters?serialize}</output:method>
<output:omit-xml-declaration>yes</output:omit-xml-declaration>
</output:serialization-parameters>),
"footnotes": serialize($transformed?footnotes,
<output:serialization-parameters xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization">
<output:indent>no</output:indent>
<output:method>html5</output:method>
<output:method>{$request?parameters?serialize}</output:method>
<output:omit-xml-declaration>yes</output:omit-xml-declaration>
</output:serialization-parameters>
),
"userParams": $userParams,
Expand Down

0 comments on commit 2ef1cc0

Please sign in to comment.