Skip to content

Commit

Permalink
fix: Support path-type outdir
Browse files Browse the repository at this point in the history
- This is for Sphinx>=7.2
  • Loading branch information
attakei committed Mar 23, 2024
1 parent 9c193ea commit 5a91386
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/atsphinx/mini18n/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,31 @@ def build_heading_content(self):
ctx = {
"config": self.app.config,
}
out_index = self.app.outdir + "/index.html"
out_template = Path(__file__).parent / "templates" / "mini18n" / "index.html"
template = Template(out_template.read_text())
out_index = (
Path("/".join([self.app.outdir, "index.html"]))
if isinstance(self.app.outdir, str)
else self.app.outdir / "index.html"
)
Path(out_index).write_text(template.render(ctx))


def build_i18_contents(args: BuildArgs):
"""Run build for coufigured language."""
lang_out_dir = (
"/".join([args.app.outdir, args.lang])
if isinstance(args.app.outdir, str)
else args.app.outdir / args.lang
)
cmd = [
"sphinx-build",
"-b",
args.builder,
"-d",
args.app.doctreedir,
args.app.srcdir,
"/".join([args.app.outdir, args.lang]),
lang_out_dir,
"-D",
f"language={args.lang}",
]
Expand Down

0 comments on commit 5a91386

Please sign in to comment.