Skip to content

Commit 2ef1cc0

Browse files
committed
Add parameter "serialize" to /api/parts endpoint to switch between HTML5 and XML serialization for content
1 parent a1ba6f9 commit 2ef1cc0

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

modules/lib/api.json

+30-1
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,16 @@
12991299
"type": "string"
13001300
}
13011301
},
1302+
{
1303+
"name": "serialize",
1304+
"in": "query",
1305+
"schema": {
1306+
"type": "string",
1307+
"enum": ["xml", "html5"],
1308+
"default": "html5"
1309+
},
1310+
"description": "should HTML content be rendered as HTML5 or XML?"
1311+
},
13021312
{
13031313
"name": "If-Modified-Since",
13041314
"in": "header",
@@ -3421,7 +3431,26 @@
34213431
}
34223432
}
34233433
}
3424-
}
3434+
},
3435+
"/sitemap.xml": {
3436+
"get": {
3437+
"description": "Return generated sitemap",
3438+
"operationId": "sitemap:sitemap",
3439+
"parameters": [],
3440+
"responses": {
3441+
"200": {
3442+
"description": "OK",
3443+
"content": {
3444+
"application/xml": {
3445+
"schema": {
3446+
"type": "string"
3447+
}
3448+
}
3449+
}
3450+
}
3451+
}
3452+
}
3453+
}
34253454
},
34263455
"security": [
34273456
{

modules/lib/api/document.xql

+4-2
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,14 @@ declare function dapi:get-fragment($request as map(*), $docs as node()*, $path a
522522
"content": serialize($transformed?content,
523523
<output:serialization-parameters xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization">
524524
<output:indent>no</output:indent>
525-
<output:method>html5</output:method>
525+
<output:method>{$request?parameters?serialize}</output:method>
526+
<output:omit-xml-declaration>yes</output:omit-xml-declaration>
526527
</output:serialization-parameters>),
527528
"footnotes": serialize($transformed?footnotes,
528529
<output:serialization-parameters xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization">
529530
<output:indent>no</output:indent>
530-
<output:method>html5</output:method>
531+
<output:method>{$request?parameters?serialize}</output:method>
532+
<output:omit-xml-declaration>yes</output:omit-xml-declaration>
531533
</output:serialization-parameters>
532534
),
533535
"userParams": $userParams,

0 commit comments

Comments
 (0)