blurry-cli 0.8.0__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.
Files changed (30) hide show
  1. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/PKG-INFO +1 -1
  2. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/markdown/__init__.py +0 -4
  3. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/plugins/jinja_plugins/blurry_image_extension.py +12 -5
  4. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/utils.py +0 -18
  5. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/pyproject.toml +1 -1
  6. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/LICENSE +0 -0
  7. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/README.md +0 -0
  8. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/__init__.py +0 -0
  9. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/__main__.py +0 -0
  10. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/async_typer.py +0 -0
  11. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/cli.py +0 -0
  12. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/constants.py +0 -0
  13. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/images.py +0 -0
  14. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/markdown/front_matter.py +0 -0
  15. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/markdown/renderer_functions/__init__.py +0 -0
  16. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/markdown/renderer_functions/render_video.py +0 -0
  17. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/open_graph.py +0 -0
  18. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/plugins/__init__.py +0 -0
  19. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/plugins/html_plugins/__init__.py +0 -0
  20. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/plugins/html_plugins/minify_html_plugin.py +0 -0
  21. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/plugins/jinja_plugins/__init__.py +0 -0
  22. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/plugins/markdown_plugins/__init__.py +0 -0
  23. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/plugins/markdown_plugins/container_plugin.py +0 -0
  24. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/plugins/markdown_plugins/punctuation_plugin.py +0 -0
  25. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/plugins/markdown_plugins/python_code_plugin.py +0 -0
  26. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/py.typed +0 -0
  27. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/schema_validation.py +0 -0
  28. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/settings.py +0 -0
  29. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/sitemap.py +0 -0
  30. {blurry_cli-0.8.0 → blurry_cli-0.8.2}/blurry/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blurry-cli
3
- Version: 0.8.0
3
+ Version: 0.8.2
4
4
  Summary: A Mistune-based static site generator for Python
5
5
  Home-page: https://github.com/blurry-dev/blurry
6
6
  License: MIT
@@ -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", {}))
@@ -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")
@@ -19,17 +20,23 @@ class BlurryImage(StandaloneTag):
19
20
  tags = {"blurry_image"}
20
21
 
21
22
  def render(self, *args, **kwargs):
22
- (image_url, width) = args
23
- image_content_path: str = "." + urlparse(image_url).path
24
- image_path = get_build_directory() / image_content_path
23
+ if len(args) == 2:
24
+ (image_url, width) = args
25
+ else:
26
+ image_url = args[0]
27
+ width = None
28
+
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
25
32
 
26
33
  try:
27
- with Image(filename=str(image_path)) as image:
34
+ with Image(filename=str(image_content_path)) as image:
28
35
  image_width = image.width
29
36
  image_height = image.height
30
37
  image_mimetype = image.mimetype
31
38
  except BlobError:
32
- warning_console.print(f"Could not find image: {image_path}")
39
+ warning_console.print(f"Could not find image: {image_content_path}")
33
40
  return ""
34
41
 
35
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "blurry-cli"
3
- version = "0.8.0"
3
+ version = "0.8.2"
4
4
  description = "A Mistune-based static site generator for Python"
5
5
  authors = ["John Franey <franey@duck.com>"]
6
6
  license = "MIT"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes