blurry-cli 0.8.1__tar.gz → 0.8.2__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.
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/PKG-INFO +1 -1
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/markdown/__init__.py +0 -4
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/plugins/jinja_plugins/blurry_image_extension.py +6 -4
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/utils.py +0 -18
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/pyproject.toml +1 -1
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/LICENSE +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/README.md +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/__init__.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/__main__.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/async_typer.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/cli.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/constants.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/images.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/markdown/front_matter.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/markdown/renderer_functions/__init__.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/markdown/renderer_functions/render_video.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/open_graph.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/plugins/__init__.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/plugins/html_plugins/__init__.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/plugins/html_plugins/minify_html_plugin.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/plugins/jinja_plugins/__init__.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/plugins/markdown_plugins/__init__.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/plugins/markdown_plugins/container_plugin.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/plugins/markdown_plugins/punctuation_plugin.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/plugins/markdown_plugins/python_code_plugin.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/py.typed +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/schema_validation.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/settings.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/sitemap.py +0 -0
- {blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/types.py +0 -0
|
@@ -29,7 +29,6 @@ from blurry.types import is_str
|
|
|
29
29
|
from blurry.utils import content_path_to_url
|
|
30
30
|
from blurry.utils import convert_relative_path_in_markdown_file_to_pathname
|
|
31
31
|
from blurry.utils import path_to_url_pathname
|
|
32
|
-
from blurry.utils import remove_lazy_loading_from_first_image
|
|
33
32
|
from blurry.utils import resolve_relative_path_in_markdown
|
|
34
33
|
|
|
35
34
|
|
|
@@ -178,9 +177,6 @@ def convert_markdown_file_to_html(filepath: Path) -> tuple[str, dict[str, Any]]:
|
|
|
178
177
|
if not is_str(html):
|
|
179
178
|
raise Exception(f"Expected html to be a string but got: {type(html)}")
|
|
180
179
|
|
|
181
|
-
# Post-process HTML
|
|
182
|
-
html = remove_lazy_loading_from_first_image(html)
|
|
183
|
-
|
|
184
180
|
# Seed front_matter with schema_data from config file
|
|
185
181
|
front_matter: dict[str, Any] = dict(SETTINGS.get("SCHEMA_DATA", {}))
|
|
186
182
|
front_matter.update(state.env.get("front_matter", {}))
|
{blurry_cli-0.8.1 → blurry_cli-0.8.2}/blurry/plugins/jinja_plugins/blurry_image_extension.py
RENAMED
|
@@ -9,6 +9,7 @@ from wand.image import Image
|
|
|
9
9
|
|
|
10
10
|
from blurry.images import add_image_width_to_path
|
|
11
11
|
from blurry.settings import get_build_directory
|
|
12
|
+
from blurry.settings import get_content_directory
|
|
12
13
|
from blurry.utils import build_path_to_url
|
|
13
14
|
|
|
14
15
|
warning_console = Console(stderr=True, style="bold yellow")
|
|
@@ -25,16 +26,17 @@ class BlurryImage(StandaloneTag):
|
|
|
25
26
|
image_url = args[0]
|
|
26
27
|
width = None
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
image_relative_pathname = "." + urlparse(image_url).path
|
|
30
|
+
image_content_path = get_content_directory() / image_relative_pathname
|
|
31
|
+
image_path = get_build_directory() / image_relative_pathname
|
|
30
32
|
|
|
31
33
|
try:
|
|
32
|
-
with Image(filename=str(
|
|
34
|
+
with Image(filename=str(image_content_path)) as image:
|
|
33
35
|
image_width = image.width
|
|
34
36
|
image_height = image.height
|
|
35
37
|
image_mimetype = image.mimetype
|
|
36
38
|
except BlobError:
|
|
37
|
-
warning_console.print(f"Could not find image: {
|
|
39
|
+
warning_console.print(f"Could not find image: {image_content_path}")
|
|
38
40
|
return ""
|
|
39
41
|
|
|
40
42
|
attributes = {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
2
|
|
|
3
|
-
from selectolax.parser import HTMLParser
|
|
4
|
-
|
|
5
3
|
from blurry.settings import get_build_directory
|
|
6
4
|
from blurry.settings import get_content_directory
|
|
7
5
|
from blurry.settings import SETTINGS
|
|
@@ -116,19 +114,3 @@ def format_schema_data(schema_data: dict) -> dict:
|
|
|
116
114
|
formatted_schema_data = {"@context": "https://schema.org"}
|
|
117
115
|
formatted_schema_data.update(schema_data)
|
|
118
116
|
return formatted_schema_data
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
def remove_lazy_loading_from_first_image(html: str) -> str:
|
|
122
|
-
parser = HTMLParser(html, use_meta_tags=False)
|
|
123
|
-
if not parser.body or not parser.body.html:
|
|
124
|
-
raise Exception("Could not parse HTML")
|
|
125
|
-
first_img_tag = parser.css_first("img")
|
|
126
|
-
if not first_img_tag:
|
|
127
|
-
return html
|
|
128
|
-
updated_tag = first_img_tag
|
|
129
|
-
try:
|
|
130
|
-
del updated_tag.attrs["loading"] # type: ignore
|
|
131
|
-
first_img_tag.replace_with(HTMLParser(updated_tag.html).body.child) # type: ignore
|
|
132
|
-
except KeyError:
|
|
133
|
-
pass
|
|
134
|
-
return parser.body.html
|
|
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
|
|
File without changes
|
|
File without changes
|