Skip to content

Commit

Permalink
fix(stlite): Explicit encode of templates
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed Dec 1, 2024
1 parent bf4a998 commit c2c647f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/atsphinx/toybox/stlite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package_root = Path(__file__).parent
logger = logging.getLogger(__name__)

page_template = Template((package_root / "page.html.jinja").read_text())
view_template = Template((package_root / "view.html.jinja").read_text())
page_template = Template((package_root / "page.html.jinja").read_text(encoding="utf8"))
view_template = Template((package_root / "view.html.jinja").read_text(encoding="utf8"))


class stlite(nodes.Element, nodes.General): # noqa: D101
Expand All @@ -35,7 +35,7 @@ def visit_stlite(self, node: stlite):
return
widget_url = app.builder.get_relative_uri(docname, widget_uri)
out.parent.mkdir(exist_ok=True, parents=True)
out.write_text(page_template.render(node.attributes))
out.write_text(page_template.render(node.attributes), encoding="utf8")
self.body.append(view_template.render(node.attributes, url=widget_url))


Expand Down

0 comments on commit c2c647f

Please sign in to comment.