Skip to content

Commit

Permalink
Merge pull request #15 from angrybayblade/release/v0.1.0-rc5
Browse files Browse the repository at this point in the history
Release `v0.1.0 rc5`
  • Loading branch information
angrybayblade authored Mar 16, 2024
2 parents b99fa3c + 23814b3 commit 2feb0e5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1>💧 PH7</h1>
</div>
<div style="display:flex; align-items: center; justify-content: center;">
Python native HTML rendering
Python native HTML templates
</div>

## Why PH7?
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG → docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.1.0-rc5 (16-03-2024)

* Adds support for including CSS and JS files in separate blocks

# v0.1.0-rc4 (15-03-2024)

* Adds template engine for Flask
Expand Down
20 changes: 20 additions & 0 deletions ph7/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,26 @@ def _include_js(self, view: str) -> t.Any:
for module in self.views["js"][view]
)

def include_js(self, context: t.Dict) -> t.Any:
"""Include js files."""
from ph7.html import unpack # pylint: disable=import-outside-toplevel

view = context["_view"]
if view not in self.views["css"] and view not in self.cache["js"]:
return unpack()

return self._include_js(view=view)

def include_css(self, context: t.Dict) -> t.Any:
"""Include css files."""
from ph7.html import unpack # pylint: disable=import-outside-toplevel

view = context["_view"]
if view not in self.views["css"] and view not in self.cache["js"]:
return unpack()

return self._include_css(view=view)

def include(self, context: t.Dict) -> t.Any:
"""Include static files."""
from ph7.html import unpack # pylint: disable=import-outside-toplevel
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
long_description = (here / "README.md").read_text(encoding="utf-8")
setup(
name="ph7",
version="0.1.0-rc4",
description="Python native HTML rendering",
version="0.1.0-rc5",
description="Python native web templates",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/angrybayblade/ph7",
Expand Down Expand Up @@ -37,7 +37,7 @@
},
project_urls={
"Documentation": "http://ph7.angrybayblade.me",
"Changelog": "https://github.com/angrybayblade/ph7/blob/main/docs/CHANGELOG",
"Changelog": "https://github.com/angrybayblade/ph7/blob/main/docs/CHANGELOG.md",
"Issue Tracker": "https://github.com/angrybayblade/ph7/issues",
},
)

0 comments on commit 2feb0e5

Please sign in to comment.