Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
[app] Moved docs template to their own dedicated file
Browse files Browse the repository at this point in the history
Much more readable
  • Loading branch information
igiloh-pinecone committed Nov 5, 2023
1 parent 2bbba59 commit 4ac9ff9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
28 changes: 1 addition & 27 deletions src/canopy_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,27 +1 @@
HTML_TEMPLATE = """<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Canopy API Spec</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="https://polybit-apps.s3.amazonaws.com/stdlib/users/pinecone/profile/image.png">
<style>
body {
margin: 0;
padding: 0;
}
</style>
<style data-styled="" data-styled-version="4.4.1"></style>
</head>
<body>
<div id="redoc-container"></div>
<title>Redoc</title>
<script src="https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js"> </script>
<script>
var spec = %s;
Redoc.init(spec, {}, document.getElementById("redoc-container"));
</script>
</body>
</html>
""" # noqa: E501

2 changes: 1 addition & 1 deletion src/canopy_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def api_docs(url):

if generated_docs:
import json
from canopy_cli import HTML_TEMPLATE
from canopy_server._redocs_template import HTML_TEMPLATE
from canopy_server.app import app
# generate docs

Expand Down
27 changes: 27 additions & 0 deletions src/canopy_server/_redocs_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
HTML_TEMPLATE = """<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Canopy API Spec</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="https://polybit-apps.s3.amazonaws.com/stdlib/users/pinecone/profile/image.png">
<style>
body {
margin: 0;
padding: 0;
}
</style>
<style data-styled="" data-styled-version="4.4.1"></style>
</head>
<body>
<div id="redoc-container"></div>
<title>Redoc</title>
<script src="https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js"> </script>
<script>
var spec = %s;
Redoc.init(spec, {}, document.getElementById("redoc-container"));
</script>
</body>
</html>
""" # noqa: E501

0 comments on commit 4ac9ff9

Please sign in to comment.