webifier 1.0.3__tar.gz → 1.0.4__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.
- {webifier-1.0.3 → webifier-1.0.4}/PKG-INFO +1 -1
- {webifier-1.0.3 → webifier-1.0.4}/webifier/_version.py +2 -2
- {webifier-1.0.3 → webifier-1.0.4}/webifier/core/html.py +25 -6
- {webifier-1.0.3 → webifier-1.0.4}/.github/workflows/python-publish.yml +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/.gitignore +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/LICENSE +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/README.md +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/action.yml +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/pyproject.toml +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/tests/test_extensions.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/__init__.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/core/__init__.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/core/base.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/core/builder.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/core/extensions.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/core/frontmatter.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/core/loader.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/core/markdown.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/interface/__init__.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/interface/cli.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/interface/io.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/interface/resolvers/__init__.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/interface/resolvers/base.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/interface/resolvers/builtins.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/interface/resolvers/engine.py +0 -0
- {webifier-1.0.3 → webifier-1.0.4}/webifier/interface/resolvers/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: webifier
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
4
4
|
Summary: Cook up a fully functional static website from YAML and Markdown.
|
|
5
5
|
Project-URL: Homepage, https://github.com/webifier/build
|
|
6
6
|
Project-URL: Repository, https://github.com/webifier/build
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '1.0.
|
|
22
|
-
__version_tuple__ = version_tuple = (1, 0,
|
|
21
|
+
__version__ = version = '1.0.4'
|
|
22
|
+
__version_tuple__ = version_tuple = (1, 0, 4)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import os
|
|
3
4
|
import re
|
|
5
|
+
from urllib.parse import unquote, urlsplit
|
|
4
6
|
|
|
5
7
|
from bs4 import BeautifulSoup
|
|
6
8
|
|
|
@@ -35,12 +37,29 @@ def process_html(
|
|
|
35
37
|
# Resolve src attributes on media tags
|
|
36
38
|
for tag in ["img", "audio", "embed", "iframe", "script", "source", "track", "video"]:
|
|
37
39
|
for src_tag in soup.find_all(tag, src=True):
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
src = src_tag["src"]
|
|
41
|
+
local_src = src
|
|
42
|
+
if "://" not in src and not src.startswith("data:"):
|
|
43
|
+
local_src = unquote(urlsplit(src).path)
|
|
44
|
+
try:
|
|
45
|
+
new_src = builder.files.copy_file(
|
|
46
|
+
local_src,
|
|
47
|
+
local_src,
|
|
48
|
+
src_dir=assets_src_dir,
|
|
49
|
+
target_dir=assets_target_dir,
|
|
50
|
+
)
|
|
51
|
+
except FileNotFoundError:
|
|
52
|
+
fallback_src = os.path.join("files", local_src)
|
|
53
|
+
if not assets_src_dir or local_src.startswith("files/") or not os.path.isfile(
|
|
54
|
+
os.path.join(assets_src_dir, fallback_src)
|
|
55
|
+
):
|
|
56
|
+
raise
|
|
57
|
+
new_src = builder.files.copy_file(
|
|
58
|
+
fallback_src,
|
|
59
|
+
fallback_src,
|
|
60
|
+
src_dir=assets_src_dir,
|
|
61
|
+
target_dir=assets_target_dir,
|
|
62
|
+
)
|
|
44
63
|
if new_src:
|
|
45
64
|
src_tag["src"] = new_src
|
|
46
65
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|