72 """Serve RapiPDF documentation page.
75 request (Request): The incoming request.
78 Response: HTML response with RapiPDF interface.
80 func_title =
"get_documentation"
81 self.
disp.log_debug(
"Serving RapiPDF documentation", func_title)
85 self.
disp.log_debug(f
"token = {token}", func_title)
88 for key, value
in RAPIPDF_CONST.RAPIPDF_OPTIONS.items():
89 if isinstance(value, bool):
91 config_options[key] =
"true"
93 config_options[key] =
"false"
95 config_options[key] = value
97 pdf_primary = config_options.get(
"pdf-primary-color",
"#4A90E2")
98 pdf_alternate = config_options.get(
"pdf-alternate-color",
"#F5F5F5")
99 pdf_title = config_options.get(
"pdf-title",
"API Documentation")
100 pdf_footer = config_options.get(
"pdf-footer-text",
"")
101 include_api_list = config_options.get(
"include-api-list",
"true")
102 include_api_details = config_options.get(
"include-api-details",
"true")
103 include_security = config_options.get(
"include-security",
"true")
105 if RAPIPDF_CONST.RAPIPDF_STYLE ==
"dark":
107 text_color =
"#ffffff"
108 status_text_color =
"#000000"
111 text_color =
"#000000"
112 status_text_color =
"#333333"
118 <meta charset="UTF-8">
119 <meta name="viewport" content="width=device-width, initial-scale=1.0">
120 <title>{self.api_title} - RapiPDF</title>
121 <script type="module" src="{RAPIPDF_CONST.RAPIPDF_CDN_JS_ENDPOINT}"></script>
126 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
127 background-color: {bg_color};
142 --primary-color: {pdf_primary};
143 --input-bg: {bg_color};
145 --primary-text: white;
153 <div class="container">
154 <h1>{self.api_title} - PDF Documentation</h1>
155 <p>Generate a comprehensive PDF document of the API specification.</p>
158 spec-url="{self.openapi_url}"
159 style="{RAPIPDF_CONST.RAPIPDF_STYLE}"
160 pdf-title="{pdf_title}"
161 pdf-footer-text="{pdf_footer}"
162 pdf-primary-color="{pdf_primary}"
163 pdf-alternate-color="{pdf_alternate}"
164 include-api-list="{str(include_api_list).lower()}"
165 include-api-details="{str(include_api_details).lower()}"
166 include-security="{str(include_security).lower()}"
167 button-label="{RAPIPDF_CONST.RAPIPDF_BUTTON_LABEL}"
174 return HCI.success(content=html_content, content_type=HttpDataTypes.HTML)
177 """Serve the RapiPDF JavaScript library file.
180 request (Request): The incoming request.
183 Response: JavaScript file response or error response if file not found.
185 file = RAPIPDF_CONST.RAPIPDF_CDN_JS
186 if not os.path.isfile(file):
187 error_msg: str = f
"Filepath: {file} does not exist or is not a file"
188 self.
disp.log_error(error_msg)