2# +==== BEGIN CatFeeder =================+
5# ...............)..(.')
7# ...............\(__)|
8# Inspired by Joan Stark
9# source https://www.asciiart.eu/
13# FILE: common_constants.py
14# CREATION DATE: 26-11-2025
15# LAST Modified: 14:43:52 19-12-2025
17# This is the backend server in charge of making the actual website work.
19# COPYRIGHT: (c) Cat Feeder
20# PURPOSE: Common constants and utilities for all documentation providers.
22# +==== END CatFeeder =================+
25from typing
import Optional
28CDN_UNPKG_BASE: str =
"https://unpkg.com"
29CDN_JSDELIVR_BASE: str =
"https://cdn.jsdelivr.net"
30CDN_CDNJS_BASE: str =
"https://cdnjs.cloudflare.com"
33HTML_DOCTYPE: str =
"<!DOCTYPE html>"
34HTML_META_CHARSET: str =
'<meta charset="utf-8">'
35HTML_META_VIEWPORT: str =
'<meta name="viewport" content="width=device-width, initial-scale=1">'
42 body_attributes: str =
""
44 """Create a complete HTML page with common structure.
47 title (str): The page title.
48 body_content (str): The HTML content for the body.
49 head_extra (str, optional): Additional head elements. Defaults to "".
50 body_attributes (str, optional): Additional body tag attributes. Defaults to "".
53 str: Complete HTML page as a string.
55 return f
"""{HTML_DOCTYPE}
60 <title>{title}</title>
63<body{' ' + body_attributes if body_attributes else ''}>
70 """Create a script tag for CDN resources.
73 url (str): The CDN URL for the script.
74 attributes (Optional[str], optional): Additional script attributes. Defaults to None.
77 str: HTML script tag as a string.
79 attr_str = f
" {attributes}" if attributes
else ""
80 return f
'<script src="{url}"{attr_str}></script>'
84 """Create a link tag for CDN resources.
87 url (str): The CDN URL for the resource.
88 rel (str, optional): The rel attribute value. Defaults to "stylesheet".
89 attributes (Optional[str], optional): Additional link attributes. Defaults to None.
92 str: HTML link tag as a string.
94 attr_str = f
" {attributes}" if attributes
else ""
95 return f
'<link rel="{rel}" href="{url}"{attr_str}>'
str create_cdn_link_tag(str url, str rel="stylesheet", Optional[str] attributes=None)
str create_html_page(str title, str body_content, str head_extra="", str body_attributes="")
str create_cdn_script_tag(str url, Optional[str] attributes=None)