Skip to content

Commit

Permalink
Keep relative path in uri (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirus authored Nov 21, 2024
1 parent e05af69 commit a9f17e9
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 9 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [0.1.3] - 2024-11-21

- Fix: Image node URI must be relative to path given in the document instead of path calculated by ``get_image_paths``.

## [0.1.2] - 2024-11-15

- Fix: Add sphinx_colorschemed_images/static directory to Python distribution.
Expand Down
2 changes: 1 addition & 1 deletion dist/js/sphinx-colorschemed-images.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/js/sphinx-colorschemed-images.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

from importlib.metadata import version as _version
import sphinx_colorschemed_images

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'sphinx-colorschemed-images'
copyright = '2024, Daniela Rus Morales'
author = 'Daniela Rus Morales'
release = _version("sphinx-colorschemed-images")

release_pattern_url = (
"https://sphinx-colorschemed-images.readthedocs.io/en/{release}/"
)

release = sphinx_colorschemed_images.__version__
releases = [release,]

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand All @@ -38,8 +44,8 @@
html_theme = "sphinx_nefertiti"

html_theme = 'sphinx_nefertiti'
html_static_path = ['_static']
html_favicon = "_static/diamond-half.svg"
html_static_path = ['static']
html_favicon = "static/diamond-half.svg"

html_theme_options = {
"documentation_font": "Open Sans",
Expand All @@ -60,6 +66,10 @@
"repository_name": "sphinx-colorschemed-images",

"current_version": f"v{release}",
"versions": [
("v%s" % item, release_pattern_url.format(release=item))
for item in releases
],

"footer_links": [
{
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sphinx-colorschemed-images",
"version": "0.1.2",
"version": "0.1.3",
"description": "Include color-scheme aware images in Sphinx projects.",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion sphinx_colorschemed_images/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from .extension import copy_colorschemed_images, extension_builder_inited

__version__ = "0.1.2"
__version__ = "0.1.3"


def setup(app) -> dict:
Expand Down
4 changes: 3 additions & 1 deletion sphinx_colorschemed_images/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def replace_image_node(self, node, image_paths):
for color_scheme, img_path in image_paths.items():
options[f"data-alt-src-color-scheme-{color_scheme}"] = img_path

options["uri"] = image_paths.get(default_color_scheme)
parent = Path(options["uri"]).parent
filename = Path(image_paths.get(default_color_scheme)).name
options["uri"] = str(parent / filename)
return colorschemed_image(node.rawsource, **options)


Expand Down

0 comments on commit a9f17e9

Please sign in to comment.