Skip to content

Commit

Permalink
fix #46
Browse files Browse the repository at this point in the history
  • Loading branch information
bckohan committed Oct 14, 2024
1 parent 2a145ce commit f336862
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 42 deletions.
63 changes: 34 additions & 29 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,48 @@
Change Log
==========

v0.5.0 (24-AUG-2024)
====================
v0.5.1 (2024-10-14)
===================

* Fixed `Spaces in image filenames can cause problems with pdf builds. <https://github.com/sphinx-contrib/typer/issues/46>`_

v0.5.0 (2024-08-24)
===================

* Implemented `Support Sphinx 8 <https://github.com/sphinx-contrib/typer/issues/45>`_
* Implemented `Support Python 3.13 <https://github.com/sphinx-contrib/typer/issues/44>`_
* Fixed `typer 0.12.5+ breaks click compatibility <https://github.com/sphinx-contrib/typer/issues/43>`_

v0.4.2 (22-AUG-2024)
v0.4.2 (2024-08-22)
====================

* Fixed `:typer: role default link text has colon where space expected <https://github.com/sphinx-contrib/typer/issues/42>`_
* Fixed `:typer: role does not allow link text <https://github.com/sphinx-contrib/typer/issues/41>`_

v0.4.1 (22-AUG-2024)
v0.4.1 (2024-08-22)
====================

* Fixed `:typer: role does not work if processed before the definition. <https://github.com/sphinx-contrib/typer/issues/40>`_
* Fixed `:typer: role link text does not reflect the actual command invocation. <https://github.com/sphinx-contrib/typer/issues/39>`_

v0.4.0 (19-AUG-2024)
v0.4.0 (2024-08-19)
====================

* Implemented `Use builtin sphinx cache to cache iframe heights instead of custom file. <https://github.com/sphinx-contrib/typer/issues/38>`_
* Implemented `Allow cross-referencing <https://github.com/sphinx-contrib/typer/issues/34>`_

v0.3.5 (17-AUG-2024)
v0.3.5 (2024-08-17)
====================

* Fixed `Lazily loaded commands throw an exception. <https://github.com/sphinx-contrib/typer/issues/37>`_
* Fixed `Changes are not detected across sphinx-build <https://github.com/sphinx-contrib/typer/issues/35>`_

v0.3.4 (15-AUG-2024)
v0.3.4 (2024-08-15)
====================

* Fixed `list_commands order should be honored when generated nested sections for subcommands. <https://github.com/sphinx-contrib/typer/issues/36>`_

v0.3.3 (15-JUL-2024)
v0.3.3 (2024-07-15)
====================

* Removed errant deepcopy introduced in last release.
Expand All @@ -49,113 +54,113 @@ v0.3.2 (yanked)
* Implemented `Add blue waves theme. <https://github.com/sphinx-contrib/typer/issues/31>`_
* Implemented `Add red sands theme. <https://github.com/sphinx-contrib/typer/issues/30>`_

v0.3.1 (11-JUN-2024)
v0.3.1 (2024-06-11)
====================

* Fixed `ruff dependency should be dev dependency only. <https://github.com/sphinx-contrib/typer/issues/29>`_

v0.3.0 (01-JUN-2024)
v0.3.0 (2024-06-01)
====================

* Implemented `Allow function hooks to be specified as import strings. <https://github.com/sphinx-contrib/typer/issues/28>`_
* Fixed `pdf builds are broken. <https://github.com/sphinx-contrib/typer/issues/27>`_


v0.2.5 (29-MAY-2024)
v0.2.5 (2024-05-29)
====================

* Fixed `Proxied Typer object check is broken. <https://github.com/sphinx-contrib/typer/issues/26>`_

v0.2.4 (29-MAY-2024)
v0.2.4 (2024-05-29)
====================

* Fixed `Support more flexible duck typing for detecting Typer objects <https://github.com/sphinx-contrib/typer/issues/25>`_

v0.2.3 (22-MAY-2024)
v0.2.3 (2024-05-22)
====================

* Fixed `when :prog: is supplied and a subcommand help is generated the usage string includes incorrect prefix to prog <https://github.com/sphinx-contrib/typer/issues/24>`_

v0.2.2 (14-MAY-2024)
v0.2.2 (2024-05-14)
====================

* Fixed `Move to ruff for tooling <https://github.com/sphinx-contrib/typer/issues/22>`_
* Fixed `Fix WARNING: cannot cache unpickable configuration value <https://github.com/sphinx-contrib/typer/issues/21>`_

v0.2.1 (11-APR-2024)
v0.2.1 (2024-04-11)
====================

* Implemented `Convert README and CONTRIBUTING to markdown. <https://github.com/sphinx-contrib/typer/issues/20>`_
* Fixed `typer-slim[all] no longer works to bring in rich <https://github.com/sphinx-contrib/typer/issues/19>`_

v0.2.0 (03-APR-2024)
v0.2.0 (2024-04-03)
====================

* Fixed `typer 0.12.0 package split breaks upgrades. <https://github.com/sphinx-contrib/typer/issues/18>`_

v0.1.12 (05-MAR-2024)
v0.1.12 (2024-03-05)
=====================

* Fixed `Typer with sphinx-autobuild going on infinite loop <https://github.com/sphinx-contrib/typer/issues/17>`_

v0.1.11 (22-FEB-2024)
v0.1.11 (2024-02-22)
=====================

* Fixed `Typer dependency erroneously downgraded. <https://github.com/sphinx-contrib/typer/issues/15>`_

v0.1.10 (21-FEB-2024)
v0.1.10 (2024-02-21)
=====================

* Fixed `Pillow version not specified for png optional dependency. <https://github.com/sphinx-contrib/typer/issues/14>`_

v0.1.9 (21-FEB-2024)
v0.1.9 (2024-02-21)
====================

* Fixed `Some dependencies have unnecessarily recent version requirements. <https://github.com/sphinx-contrib/typer/issues/13>`_

v0.1.8 (20-FEB-2024)
v0.1.8 (2024-02-20)
====================

* Fixed `When using convert-png sometimes the pngs images are cutoff too short. <https://github.com/sphinx-contrib/typer/issues/12>`_

v0.1.7 (31-JAN-2024)
v0.1.7 (2024-01-31)
====================

* Fixed reopened issue: `nested class attribute import paths for typer apps are broken. <https://github.com/sphinx-contrib/typer/issues/11>`_

v0.1.6 (31-JAN-2024)
v0.1.6 (2024-01-31)
====================

* Fixed `nested class attribute import paths for typer apps are broken. <https://github.com/sphinx-contrib/typer/issues/11>`_


v0.1.5 (30-JAN-2024)
v0.1.5 (2024-01-30)
====================

* Fixed `When the sphinx app is an attribute on a class the import fails. <https://github.com/sphinx-contrib/typer/issues/10>`_

v0.1.4 (21-DEC-2023)
v0.1.4 (2023-12-21)
====================

* Meta data updated reflecting repository move into the sphinx-contrib organization.

v0.1.3 (19-DEC-2023)
v0.1.3 (2023-12-19)
====================

* Fixed repository location in package meta data.

v0.1.2 (19-DEC-2023)
v0.1.2 (2023-12-19)
====================

* Try big 4 web browser managers before giving up when selenium features are used.
* Fixed pypi.org rendering of the readme, and rtd documentation build.

v0.1.1 (19-DEC-2023)
v0.1.1 (2023-12-19)
====================

* Fixed pypi.org rendering of the readme.

v0.1.0 (19-DEC-2023)
v0.1.0 (2023-12-19)
====================

* Initial Release
23 changes: 14 additions & 9 deletions sphinxcontrib/typer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,14 @@ def get_console(stderr: bool = False) -> Console:
**export_options,
)

if self.typer_convert_png:
png_path = Path(self.env.app.builder.outdir) / (
f'{normal_cmd.replace(":", "_")}_{self.uuid(normal_cmd)}.png'
def to_path(name: str, ext: str) -> Path:
return (
Path(self.env.app.builder.outdir)
/ f'{name.replace(":", "_").replace(" ", "_")}_{self.uuid(name)}.{ext}'
)

if self.typer_convert_png:
png_path = to_path(normal_cmd, "png")
get_function(self.env.app.config.typer_convert_png)(
self, rendered, png_path
)
Expand All @@ -551,13 +555,14 @@ def get_console(stderr: bool = False) -> Console:
if "html" in self.builder:
section += nodes.raw("", rendered, format="html")
else:
img_name = f'{normal_cmd.replace(":", "_")}_{self.uuid(normal_cmd)}'
out_dir = Path(self.env.app.builder.outdir)
(out_dir / f"{img_name}.svg").write_text(rendered)
pdf_img = out_dir / f"{img_name}.pdf"
get_function(self.env.app.config.typer_svg2pdf)(self, rendered, pdf_img)
svg_path = to_path(normal_cmd, "svg")
pdf_path = to_path(normal_cmd, "pdf")
svg_path.write_text(rendered)
get_function(self.env.app.config.typer_svg2pdf)(
self, rendered, pdf_path
)
section += nodes.image(
uri=os.path.relpath(pdf_img, Path(self.env.srcdir)),
uri=os.path.relpath(pdf_path, Path(self.env.srcdir)),
alt=section_title,
)

Expand Down
17 changes: 13 additions & 4 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@ def test_sphinx_latex_build():


def build_example(
name, builder, example_dir=CLICK_EXAMPLES, clean_first=True, subprocess=False
name,
builder,
example_dir=CLICK_EXAMPLES,
clean_first=True,
subprocess=False,
project=None,
):
cwd = os.getcwd()
ex_dir = example_dir / name
Expand All @@ -169,8 +174,11 @@ def build_example(
# Build the documentation
app.build()
else:
os.system(
f"poetry run sphinx-build {ex_dir} {bld_dir / builder} -c {ex_dir.parent}"
assert (
os.system(
f"poetry run sphinx-build {ex_dir} {bld_dir / builder} -c {ex_dir.parent}"
)
== 0
)

os.chdir(cwd)
Expand All @@ -179,7 +187,8 @@ def build_example(
elif builder == "text":
result = (bld_dir / builder / "index.txt").read_text()
elif builder == "latex":
from conf import project
if not project:
from conf import project

result = (
bld_dir / builder / f'{project.lower().replace(" ", "")}.tex'
Expand Down

0 comments on commit f336862

Please sign in to comment.