Skip to content

Commit 6cde017

Browse files
authored
Merge branch 'main' into html_not_str
2 parents 855e46d + 1211512 commit 6cde017

File tree

12 files changed

+400
-371
lines changed

12 files changed

+400
-371
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
2-
- repo: https://github.com/ambv/black
3-
rev: 22.3.0
2+
- repo: https://github.com/psf/black
3+
rev: "24.2.0"
44
hooks:
55
- id: black
66
language_version: python3

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Breaking changes
1111

12-
* `HTML` no longer inherits from `str`. This was done to avoid confusion between strings and `HTML` objects. (#86)
12+
* `HTML` no longer inherits from `str`. It now inherits from `collections.UserString`. This was done to avoid confusion between `str` and `HTML` objects. (#86)
1313

1414
* `Tag` attributes no longer silently support `HTML` as values. (#86)
1515

@@ -21,6 +21,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121

2222
* Exported `ReprHtml` protocol class. If an object has a `_repr_html_` method, then it is of instance `ReprHtml`. (#86)
2323

24+
## [0.5.3] 2024-07-18
25+
26+
* HTML tags in docstrings are now escaped. (#90)
27+
28+
## [0.5.2] 2024-05-23
29+
30+
* The `HTMLDependency.copy()` method can now correctly copy folders in depenendencies that both include directories and have `all_files=True`. (#87)
2431

2532
## [0.5.1] 2023-12-18
2633

htmltools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.5.1"
1+
__version__ = "0.5.3"
22

33
from . import svg, tags
44
from ._core import TagAttrArg # pyright: ignore[reportUnusedImport] # noqa: F401

htmltools/_core.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ def copy_to(self, path: str, include_version: bool = True) -> None:
16311631
# Verify they all exist
16321632
for f in src_files:
16331633
src_file = os.path.join(paths["source"], f)
1634-
if not os.path.isfile(src_file):
1634+
if not os.path.exists(src_file):
16351635
raise Exception(
16361636
f"Failed to copy HTML dependency {self.name}-{str(self.version)} "
16371637
+ f"because {src_file} doesn't exist."
@@ -1648,7 +1648,10 @@ def copy_to(self, path: str, include_version: bool = True) -> None:
16481648
src_file = os.path.join(paths["source"], f)
16491649
target_file = os.path.join(target_dir, f)
16501650
os.makedirs(os.path.dirname(target_file), exist_ok=True)
1651-
shutil.copy2(src_file, target_file)
1651+
if os.path.isfile(src_file):
1652+
shutil.copy2(src_file, target_file)
1653+
elif os.path.isdir(src_file):
1654+
shutil.copytree(src_file, target_file)
16521655

16531656
def _validate_dicts(self, ld: Iterable[object], req_attr: list[str]) -> None:
16541657
for d in ld:
@@ -1762,7 +1765,7 @@ def _tag_show(
17621765
import IPython # pyright: ignore[reportUnknownVariableType]
17631766

17641767
ipy = ( # pyright: ignore[reportUnknownVariableType]
1765-
IPython.get_ipython() # pyright: ignore[reportUnknownMemberType]
1768+
IPython.get_ipython() # pyright: ignore[reportUnknownMemberType, reportPrivateImportUsage]
17661769
)
17671770
renderer = "ipython" if ipy else "browser"
17681771
except ImportError:

0 commit comments

Comments
 (0)