html5cc 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
html5cc-0.3.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jason Lee Miller
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
html5cc-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: html5cc
3
+ Version: 0.3.0
4
+ Summary: A small Python module for building HTML5 documents and CSS3 stylesheets.
5
+ Author: Jason Miller
6
+ License: MIT
7
+ Project-URL: Homepage, https://jasonmiller-cc.github.io/html5/
8
+ Project-URL: Documentation, https://jasonmiller-cc.github.io/html5/
9
+ Project-URL: Source, https://github.com/jasonmiller-cc/html5
10
+ Project-URL: Changelog, https://github.com/jasonmiller-cc/html5/blob/main/CHANGELOG.md
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Provides-Extra: test
19
+ Requires-Dist: pytest>=8.0; extra == "test"
20
+ Requires-Dist: pytest-cov>=5.0; extra == "test"
21
+ Provides-Extra: docs
22
+ Requires-Dist: furo>=2024.8.6; extra == "docs"
23
+ Requires-Dist: myst-parser>=4.0; extra == "docs"
24
+ Requires-Dist: sphinx>=7.4; extra == "docs"
25
+ Dynamic: license-file
26
+
27
+ # html5
28
+
29
+ Small Python helpers for building HTML5 documents, CSS, and JavaScript assets from Python.
30
+
31
+ Documentation is published on GitHub Pages at [jasonmiller-cc.github.io/html5](https://jasonmiller-cc.github.io/html5/).
32
+
33
+ The package ships with HTML5 element classes, CSS node classes, JavaScript helpers, CDN helpers for Bootstrap 5 and Tailwind, optimized Google Fonts helpers, a disk writer, and semantic version metadata.
34
+
35
+ ## Installation
36
+
37
+ `html5cc` is published to [PyPI](https://pypi.org/project/html5cc/).
38
+ The import name is still `html5`.
39
+
40
+ ```bash
41
+ pip install html5cc
42
+ ```
43
+
44
+ **requirements.txt**
45
+
46
+ ```text
47
+ html5cc==0.3.0
48
+ ```
49
+
50
+ **pyproject.toml (uv)**
51
+
52
+ ```toml
53
+ [project]
54
+ dependencies = ["html5cc>=0.3.0"]
55
+ ```
56
+
57
+ See the [Installation docs](https://jasonmiller-cc.github.io/html5/installation.html) for Poetry and other options.
58
+
59
+ ## Example
60
+
61
+ ```python
62
+ from html5 import (
63
+ CSSDeclaration,
64
+ CSSKeyframe,
65
+ CSSStyleSheet,
66
+ Div,
67
+ H1,
68
+ HtmlDocument,
69
+ Img,
70
+ MarkupWriter,
71
+ bootstrap5_bundle_script,
72
+ bootstrap5_stylesheet,
73
+ google_charts_loader,
74
+ google_charts_package_loader,
75
+ google_fonts_assets,
76
+ inline_style,
77
+ tailwind_script,
78
+ )
79
+
80
+ styles = CSSStyleSheet()
81
+ styles.add_comment("base styles")
82
+ styles.add_import("reset.css")
83
+ styles.add_rule("body", margin="0", font_family="system-ui")
84
+ styles.add_rule("h1", color="#1f2937")
85
+ styles.add_media("screen and (min-width: 40rem)", CSSDeclaration("color", "black"))
86
+ styles.add_keyframes("fade", CSSKeyframe("from", ("opacity", 0)), CSSKeyframe("to", ("opacity", 1)))
87
+
88
+ doc = (
89
+ HtmlDocument(title="Hello HTML5")
90
+ .add_head(*google_fonts_assets("Inter"))
91
+ .add_head(bootstrap5_stylesheet())
92
+ .add_head(tailwind_script())
93
+ .add_head(bootstrap5_bundle_script())
94
+ .add_head(google_charts_loader())
95
+ .add_body(Div(H1("Hello, world!"), Img(src="hero.png", style=inline_style(("border_radius", "8px")))))
96
+ )
97
+
98
+ print(doc.render())
99
+
100
+ chart_loader = google_charts_package_loader(["corechart", "table"], callback="drawChart")
101
+ writer = MarkupWriter()
102
+ writer.write_html("dist/index.html", doc)
103
+ writer.write_css("dist/site.css", styles)
104
+ writer.write_html("dist/charts.html", HtmlDocument(title="Charts").add_head(chart_loader))
105
+ ```
106
+
107
+ ## JavaScript Helpers
108
+
109
+ Use `javascript_link()` and `javascript_script()` for arbitrary script tags and inline code. The library also exposes `bootstrap5_bundle_script()` and Google Charts helpers so you can wire up common browser libraries without hand-building script tags.
110
+
111
+ ## Asset Helpers
112
+
113
+ Tailwind is injected with the official Play CDN script because that is the fastest supported browser-side setup for this library. Bootstrap 5 is injected as a CSS stylesheet from jsDelivr. Google Fonts are emitted as a preconnect pair plus a CSS2 stylesheet link so browsers can establish connections early and only download the fonts you ask for.
114
+
115
+ Common Tailwind class families that pair well with the helpers:
116
+
117
+ - Layout: `container`, `mx-auto`, `flex`, `grid`, `gap-*`, `items-center`, `justify-between`
118
+ - Spacing: `p-*`, `px-*`, `py-*`, `m-*`, `space-x-*`, `space-y-*`
119
+ - Typography: `text-*`, `font-*`, `leading-*`, `tracking-*`
120
+ - Surface: `bg-*`, `text-*`, `border-*`, `rounded-*`, `shadow-*`
121
+ - Responsive prefixes: `sm:`, `md:`, `lg:`, `xl:`, `2xl:`
122
+
123
+ Common Bootstrap 5 class families that pair well with the helpers:
124
+
125
+ - Layout and grid: `container`, `container-fluid`, `row`, `col`, `g-*`, `row-cols-*`
126
+ - Spacing and display: `m-*`, `p-*`, `d-flex`, `d-grid`, `gap-*`, `justify-content-*`, `align-items-*`
127
+ - Typography: `lead`, `fw-bold`, `fst-italic`, `text-muted`, `text-center`, `text-nowrap`
128
+ - Components: `btn`, `btn-primary`, `card`, `badge`, `alert`, `navbar`, `modal`
129
+ - Responsive prefixes: `sm`, `md`, `lg`, `xl`, `xxl`
130
+
131
+ Google Fonts examples:
132
+
133
+ - `google_fonts_assets("Inter")`
134
+ - `google_fonts_assets("Inter", "Open Sans")`
135
+ - `google_fonts_assets("Roboto", weights=(400, 700), text="Hello world")`
136
+
137
+ ## Layout
138
+
139
+ - `src/html5/document.py` contains the HTML5 document and element primitives.
140
+ - `src/html5/elements.py` contains generated classes for standard HTML5 tags.
141
+ - `src/html5/css.py` contains CSS node classes for comments, declarations, rules, at-rules, keyframes, inline styles, and `<style>` generation.
142
+ - `src/html5/js.py` contains JavaScript helpers for inline scripts, external scripts, Bootstrap 5, and Google Charts.
143
+ - `src/html5/writer.py` contains a disk writer for rendered HTML and CSS outputs.
144
+ - `src/html5/version.py` stores the semantic version string used by packaging.
145
+
146
+ ## Versioning
147
+
148
+ This project uses semantic versioning. The current package version is `0.3.0`, and the release history is documented in [CHANGELOG.md](CHANGELOG.md).
@@ -0,0 +1,122 @@
1
+ # html5
2
+
3
+ Small Python helpers for building HTML5 documents, CSS, and JavaScript assets from Python.
4
+
5
+ Documentation is published on GitHub Pages at [jasonmiller-cc.github.io/html5](https://jasonmiller-cc.github.io/html5/).
6
+
7
+ The package ships with HTML5 element classes, CSS node classes, JavaScript helpers, CDN helpers for Bootstrap 5 and Tailwind, optimized Google Fonts helpers, a disk writer, and semantic version metadata.
8
+
9
+ ## Installation
10
+
11
+ `html5cc` is published to [PyPI](https://pypi.org/project/html5cc/).
12
+ The import name is still `html5`.
13
+
14
+ ```bash
15
+ pip install html5cc
16
+ ```
17
+
18
+ **requirements.txt**
19
+
20
+ ```text
21
+ html5cc==0.3.0
22
+ ```
23
+
24
+ **pyproject.toml (uv)**
25
+
26
+ ```toml
27
+ [project]
28
+ dependencies = ["html5cc>=0.3.0"]
29
+ ```
30
+
31
+ See the [Installation docs](https://jasonmiller-cc.github.io/html5/installation.html) for Poetry and other options.
32
+
33
+ ## Example
34
+
35
+ ```python
36
+ from html5 import (
37
+ CSSDeclaration,
38
+ CSSKeyframe,
39
+ CSSStyleSheet,
40
+ Div,
41
+ H1,
42
+ HtmlDocument,
43
+ Img,
44
+ MarkupWriter,
45
+ bootstrap5_bundle_script,
46
+ bootstrap5_stylesheet,
47
+ google_charts_loader,
48
+ google_charts_package_loader,
49
+ google_fonts_assets,
50
+ inline_style,
51
+ tailwind_script,
52
+ )
53
+
54
+ styles = CSSStyleSheet()
55
+ styles.add_comment("base styles")
56
+ styles.add_import("reset.css")
57
+ styles.add_rule("body", margin="0", font_family="system-ui")
58
+ styles.add_rule("h1", color="#1f2937")
59
+ styles.add_media("screen and (min-width: 40rem)", CSSDeclaration("color", "black"))
60
+ styles.add_keyframes("fade", CSSKeyframe("from", ("opacity", 0)), CSSKeyframe("to", ("opacity", 1)))
61
+
62
+ doc = (
63
+ HtmlDocument(title="Hello HTML5")
64
+ .add_head(*google_fonts_assets("Inter"))
65
+ .add_head(bootstrap5_stylesheet())
66
+ .add_head(tailwind_script())
67
+ .add_head(bootstrap5_bundle_script())
68
+ .add_head(google_charts_loader())
69
+ .add_body(Div(H1("Hello, world!"), Img(src="hero.png", style=inline_style(("border_radius", "8px")))))
70
+ )
71
+
72
+ print(doc.render())
73
+
74
+ chart_loader = google_charts_package_loader(["corechart", "table"], callback="drawChart")
75
+ writer = MarkupWriter()
76
+ writer.write_html("dist/index.html", doc)
77
+ writer.write_css("dist/site.css", styles)
78
+ writer.write_html("dist/charts.html", HtmlDocument(title="Charts").add_head(chart_loader))
79
+ ```
80
+
81
+ ## JavaScript Helpers
82
+
83
+ Use `javascript_link()` and `javascript_script()` for arbitrary script tags and inline code. The library also exposes `bootstrap5_bundle_script()` and Google Charts helpers so you can wire up common browser libraries without hand-building script tags.
84
+
85
+ ## Asset Helpers
86
+
87
+ Tailwind is injected with the official Play CDN script because that is the fastest supported browser-side setup for this library. Bootstrap 5 is injected as a CSS stylesheet from jsDelivr. Google Fonts are emitted as a preconnect pair plus a CSS2 stylesheet link so browsers can establish connections early and only download the fonts you ask for.
88
+
89
+ Common Tailwind class families that pair well with the helpers:
90
+
91
+ - Layout: `container`, `mx-auto`, `flex`, `grid`, `gap-*`, `items-center`, `justify-between`
92
+ - Spacing: `p-*`, `px-*`, `py-*`, `m-*`, `space-x-*`, `space-y-*`
93
+ - Typography: `text-*`, `font-*`, `leading-*`, `tracking-*`
94
+ - Surface: `bg-*`, `text-*`, `border-*`, `rounded-*`, `shadow-*`
95
+ - Responsive prefixes: `sm:`, `md:`, `lg:`, `xl:`, `2xl:`
96
+
97
+ Common Bootstrap 5 class families that pair well with the helpers:
98
+
99
+ - Layout and grid: `container`, `container-fluid`, `row`, `col`, `g-*`, `row-cols-*`
100
+ - Spacing and display: `m-*`, `p-*`, `d-flex`, `d-grid`, `gap-*`, `justify-content-*`, `align-items-*`
101
+ - Typography: `lead`, `fw-bold`, `fst-italic`, `text-muted`, `text-center`, `text-nowrap`
102
+ - Components: `btn`, `btn-primary`, `card`, `badge`, `alert`, `navbar`, `modal`
103
+ - Responsive prefixes: `sm`, `md`, `lg`, `xl`, `xxl`
104
+
105
+ Google Fonts examples:
106
+
107
+ - `google_fonts_assets("Inter")`
108
+ - `google_fonts_assets("Inter", "Open Sans")`
109
+ - `google_fonts_assets("Roboto", weights=(400, 700), text="Hello world")`
110
+
111
+ ## Layout
112
+
113
+ - `src/html5/document.py` contains the HTML5 document and element primitives.
114
+ - `src/html5/elements.py` contains generated classes for standard HTML5 tags.
115
+ - `src/html5/css.py` contains CSS node classes for comments, declarations, rules, at-rules, keyframes, inline styles, and `<style>` generation.
116
+ - `src/html5/js.py` contains JavaScript helpers for inline scripts, external scripts, Bootstrap 5, and Google Charts.
117
+ - `src/html5/writer.py` contains a disk writer for rendered HTML and CSS outputs.
118
+ - `src/html5/version.py` stores the semantic version string used by packaging.
119
+
120
+ ## Versioning
121
+
122
+ This project uses semantic versioning. The current package version is `0.3.0`, and the release history is documented in [CHANGELOG.md](CHANGELOG.md).
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "html5cc"
7
+ description = "A small Python module for building HTML5 documents and CSS3 stylesheets."
8
+ readme = "README.md"
9
+ requires-python = ">=3.10"
10
+ dynamic = ["version"]
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "Jason Miller" }
14
+ ]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3 :: Only",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+
22
+ [project.urls]
23
+ Homepage = "https://jasonmiller-cc.github.io/html5/"
24
+ Documentation = "https://jasonmiller-cc.github.io/html5/"
25
+ Source = "https://github.com/jasonmiller-cc/html5"
26
+ Changelog = "https://github.com/jasonmiller-cc/html5/blob/main/CHANGELOG.md"
27
+
28
+ [project.optional-dependencies]
29
+ test = [
30
+ "pytest>=8.0",
31
+ "pytest-cov>=5.0",
32
+ ]
33
+ docs = [
34
+ "furo>=2024.8.6",
35
+ "myst-parser>=4.0",
36
+ "sphinx>=7.4",
37
+ ]
38
+
39
+ [tool.setuptools]
40
+ package-dir = {"" = "src"}
41
+
42
+ [tool.setuptools.dynamic]
43
+ version = {attr = "html5.version.__version__"}
44
+
45
+ [tool.setuptools.packages.find]
46
+ where = ["src"]
47
+
48
+ [tool.pytest.ini_options]
49
+ addopts = "-q --cov=html5 --cov-report=term-missing --cov-fail-under=80"
50
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,42 @@
1
+ """HTML5 document and CSS3 helpers."""
2
+
3
+ from .css import (
4
+ CSSAtRule,
5
+ CSSComment,
6
+ CSSDeclaration,
7
+ CSSLink,
8
+ CSSImportRule,
9
+ CSSInlineStyle,
10
+ CSSKeyframe,
11
+ CSSKeyframesRule,
12
+ CSSLayerRule,
13
+ CSSMediaRule,
14
+ CSSNode,
15
+ CSSRule,
16
+ CSSStyleElement,
17
+ CSSStyleSheet,
18
+ CSSSupportsRule,
19
+ BOOTSTRAP5_CSS_URL,
20
+ GOOGLE_FONTS_PRECONNECT_URL,
21
+ GOOGLE_FONTS_STATIC_URL,
22
+ TAILWIND_PLAY_CDN_URL,
23
+ bootstrap5_stylesheet,
24
+ google_fonts_assets,
25
+ google_fonts_url,
26
+ inline_style,
27
+ tailwind_script,
28
+ style_tag,
29
+ )
30
+ from .document import Comment, Doctype, Element, HtmlDocument, Node, Raw, Text, comment, doctype, doctype_node, element, raw, text
31
+ from .elements import *
32
+ from .version import __version__
33
+ from .writer import MarkupWriter
34
+ from .js import (
35
+ JSNode,
36
+ JSScript,
37
+ bootstrap5_bundle_script,
38
+ google_charts_loader,
39
+ google_charts_package_loader,
40
+ javascript_link,
41
+ javascript_script,
42
+ )