Skip to content

Commit

Permalink
Using UTF-8 encoding in extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSpaar committed Jun 25, 2024
1 parent 565f9da commit 9fa2b63
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/markdown_spa/extensions/SASS/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def TO_WATCH(self) -> list:
def render(self) -> None:
from sass import compile

with open(f"{self.config.dist_assets_path}/style.css", "w") as f:
with open(f"{self.config.dist_assets_path}/style.css", "w", encoding="utf-8") as f:
f.write(compile(
output_style="compressed",
filename=f"{self.config.root}/{self.get_option('main_path')}"
Expand Down
4 changes: 2 additions & 2 deletions src/markdown_spa/extensions/Sitemap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def render(self) -> None:
self.get_option("sitemap")
)

with open(f"{self.config.dist_path}/robots.txt", "w") as f:
with open(f"{self.config.dist_path}/robots.txt", "w", encoding="utf-8") as f:
f.write(robots_template.render(url=self.config.base_url))

with open(f"{self.config.dist_path}/sitemap.xml", "w") as f:
with open(f"{self.config.dist_path}/sitemap.xml", "w", encoding="utf-8") as f:
f.write(sitemap_template.render(
tree=self.generator.tree, url=self.config.base_url,
date=datetime.now().strftime("%Y-%m-%dT%H:%M:%S+00:00")
Expand Down
2 changes: 1 addition & 1 deletion src/markdown_spa/extensions/Tailwind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ def initialize(**kwargs) -> None:
remove("./assets/style.css")

if kwargs["input_file"]:
with open(kwargs["input_file"], "w") as file:
with open(kwargs["input_file"], "w", encoding="utf-8") as file:
file.write("@tailwind base;\n@tailwind components;\n@tailwind utilities;\n\n")
2 changes: 1 addition & 1 deletion src/markdown_spa/generator/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, generator: 'Generator') -> None:

@property
@abstractmethod
def TO_WATCH(cls) -> list[str]:
def TO_WATCH(self) -> list[str]:
"""A list of paths to watch for changes"""
...

Expand Down

0 comments on commit 9fa2b63

Please sign in to comment.