blurry-cli 0.11.0__tar.gz → 0.12.0__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.11.0 → blurry_cli-0.12.0}/PKG-INFO +1 -1
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/__init__.py +40 -10
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/templates.py +6 -5
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/pyproject.toml +1 -1
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/LICENSE +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/README.md +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/__main__.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/async_typer.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/cli.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/constants.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/images.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/markdown/__init__.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/markdown/front_matter.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/markdown/renderer_functions/__init__.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/markdown/renderer_functions/render_video.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/open_graph.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/plugins/__init__.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/plugins/html_plugins/__init__.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/plugins/html_plugins/minify_html_plugin.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/plugins/jinja_plugins/__init__.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/plugins/jinja_plugins/blurry_image_extension.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/plugins/markdown_plugins/__init__.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/plugins/markdown_plugins/container_plugin.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/plugins/markdown_plugins/punctuation_plugin.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/plugins/markdown_plugins/python_code_plugin.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/py.typed +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/schema_validation.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/settings.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/sitemap.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/types.py +0 -0
- {blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/utils.py +0 -0
|
@@ -54,7 +54,7 @@ warning_console = Console(stderr=True, style="bold yellow")
|
|
|
54
54
|
app = AsyncTyper()
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
async def process_non_markdown_file(filepath: Path):
|
|
57
|
+
async def process_non_markdown_file(filepath: Path, file_data_by_directory):
|
|
58
58
|
CONTENT_DIR = get_content_directory()
|
|
59
59
|
mimetype, _ = mimetypes.guess_type(filepath, strict=False)
|
|
60
60
|
relative_filepath = filepath.relative_to(CONTENT_DIR)
|
|
@@ -62,6 +62,13 @@ async def process_non_markdown_file(filepath: Path):
|
|
|
62
62
|
output_file = Path(build_filepath)
|
|
63
63
|
output_file.parent.mkdir(exist_ok=True, parents=True)
|
|
64
64
|
|
|
65
|
+
# Process Jinja files
|
|
66
|
+
if ".jinja" in filepath.suffixes:
|
|
67
|
+
# Process file
|
|
68
|
+
jinja_env = get_jinja_env()
|
|
69
|
+
process_jinja_file(filepath, jinja_env, file_data_by_directory)
|
|
70
|
+
return
|
|
71
|
+
|
|
65
72
|
# Copy file to build directory
|
|
66
73
|
shutil.copyfile(filepath, build_filepath)
|
|
67
74
|
|
|
@@ -73,6 +80,27 @@ async def process_non_markdown_file(filepath: Path):
|
|
|
73
80
|
await generate_images_for_srcset(filepath)
|
|
74
81
|
|
|
75
82
|
|
|
83
|
+
def process_jinja_file(filepath: Path, jinja_env: Environment, file_data_by_directory):
|
|
84
|
+
build_directory = get_build_directory()
|
|
85
|
+
content_directory = get_content_directory()
|
|
86
|
+
template = jinja_env.get_template(str(filepath.relative_to(content_directory)))
|
|
87
|
+
context = {
|
|
88
|
+
"file_data_by_directory": {
|
|
89
|
+
str(path): data for path, data in deepcopy(file_data_by_directory).items()
|
|
90
|
+
},
|
|
91
|
+
"settings": deepcopy(SETTINGS),
|
|
92
|
+
"datetime": datetime,
|
|
93
|
+
}
|
|
94
|
+
filepath_with_new_extension = filepath.with_suffix(
|
|
95
|
+
filepath.suffix.replace(".jinja", "")
|
|
96
|
+
)
|
|
97
|
+
filepath_in_build = build_directory / filepath_with_new_extension.relative_to(
|
|
98
|
+
content_directory
|
|
99
|
+
)
|
|
100
|
+
html = template.render(dataclasses=dataclasses, **context)
|
|
101
|
+
filepath_in_build.write_text(html)
|
|
102
|
+
|
|
103
|
+
|
|
76
104
|
async def write_html_file(
|
|
77
105
|
file_data: MarkdownFileData,
|
|
78
106
|
file_data_list: list[MarkdownFileData],
|
|
@@ -175,14 +203,8 @@ async def build(release=True):
|
|
|
175
203
|
markdown_tasks: list[Coroutine] = []
|
|
176
204
|
non_markdown_tasks: list[Coroutine] = []
|
|
177
205
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if filepath.suffix != ".md":
|
|
181
|
-
non_markdown_tasks.append(process_non_markdown_file(filepath))
|
|
182
|
-
continue
|
|
183
|
-
|
|
184
|
-
# Handle Markdown files
|
|
185
|
-
|
|
206
|
+
# Gather metadata from Markdown files
|
|
207
|
+
for filepath in path.glob("**/*.md"):
|
|
186
208
|
# Extract filepath for storing context data and writing out
|
|
187
209
|
relative_filepath = filepath.relative_to(CONTENT_DIR)
|
|
188
210
|
directory = relative_filepath.parent
|
|
@@ -198,11 +220,19 @@ async def build(release=True):
|
|
|
198
220
|
)
|
|
199
221
|
file_data_by_directory[directory].append(file_data)
|
|
200
222
|
|
|
201
|
-
|
|
223
|
+
# Handle images and other files
|
|
224
|
+
for filepath in path.glob("**/*"):
|
|
225
|
+
if filepath.suffix == ".md" or filepath.is_dir():
|
|
226
|
+
continue
|
|
227
|
+
non_markdown_tasks.append(
|
|
228
|
+
process_non_markdown_file(filepath, file_data_by_directory)
|
|
229
|
+
)
|
|
202
230
|
|
|
203
231
|
# Sort file data by publishedDate/createdDate, descending, if present
|
|
204
232
|
file_data_by_directory = sort_directory_file_data_by_date(file_data_by_directory)
|
|
205
233
|
|
|
234
|
+
non_markdown_tasks.append(write_sitemap_file(file_data_by_directory))
|
|
235
|
+
|
|
206
236
|
for file_data_list in file_data_by_directory.values():
|
|
207
237
|
for file_data in file_data_list:
|
|
208
238
|
markdown_tasks.append(
|
|
@@ -5,6 +5,7 @@ from jinja2 import select_autoescape
|
|
|
5
5
|
|
|
6
6
|
from blurry.plugins import discovered_jinja_extensions
|
|
7
7
|
from blurry.plugins import discovered_jinja_filter_plugins
|
|
8
|
+
from blurry.settings import get_content_directory
|
|
8
9
|
from blurry.settings import get_templates_directory
|
|
9
10
|
from blurry.settings import SETTINGS
|
|
10
11
|
|
|
@@ -14,16 +15,16 @@ def get_jinja_env() -> Environment:
|
|
|
14
15
|
Returns a Jinja environment complete with JinjaX and any installed Jinja extensions and filters.
|
|
15
16
|
"""
|
|
16
17
|
templates_directory = get_templates_directory()
|
|
18
|
+
content_directory = get_content_directory()
|
|
17
19
|
jinja_env = Environment(
|
|
18
|
-
loader=FileSystemLoader(templates_directory),
|
|
20
|
+
loader=FileSystemLoader([content_directory, templates_directory]),
|
|
19
21
|
autoescape=select_autoescape(
|
|
20
|
-
list(
|
|
22
|
+
enabled_extensions=list(
|
|
21
23
|
{
|
|
22
24
|
SETTINGS["MARKDOWN_FILE_JINJA_TEMPLATE_EXTENSION"].lstrip("."),
|
|
23
|
-
"
|
|
24
|
-
"xml",
|
|
25
|
+
"jinja",
|
|
25
26
|
}
|
|
26
|
-
)
|
|
27
|
+
),
|
|
27
28
|
),
|
|
28
29
|
extensions=[
|
|
29
30
|
jinja_extension.load() for jinja_extension in discovered_jinja_extensions
|
|
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
|
{blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/plugins/jinja_plugins/blurry_image_extension.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/plugins/markdown_plugins/punctuation_plugin.py
RENAMED
|
File without changes
|
{blurry_cli-0.11.0 → blurry_cli-0.12.0}/blurry/plugins/markdown_plugins/python_code_plugin.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|