1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

#123: use JS raw strings

This commit is contained in:
Steffo 2020-05-10 01:25:29 +02:00
parent 04e8bdb02a
commit 103e6ea4b5
Signed by: steffo
GPG key ID: 896A80F55F7C97F0

View file

@ -37,8 +37,6 @@ class DocsStar(PageStar):
} }
}) })
escaped_spec = spec.replace(r"'", r"\'")
return HTMLResponse( return HTMLResponse(
f""" f"""
<html lang="en"> <html lang="en">
@ -52,7 +50,7 @@ class DocsStar(PageStar):
<div id="docs"/> <div id="docs"/>
<script> <script>
const ui = SwaggerUIBundle({{ const ui = SwaggerUIBundle({{
spec: JSON.parse('{escaped_spec}'), spec: JSON.parse(r`{spec}`),
dom_id: '#docs', dom_id: '#docs',
presets: [ presets: [
SwaggerUIBundle.presets.apis, SwaggerUIBundle.presets.apis,