diff --git a/ChangeLog.md b/ChangeLog.md index 6d40382..d17f800 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,9 @@ # Release Notes +## [0.2.1] - 2024-11-26 + +- Fix: destination directory was not properly referred to when copying images. + ## [0.2.0] - 2024-11-25 - Remove unnecessary `console.log`. diff --git a/Makefile b/Makefile index 41c49fa..accad0e 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,10 @@ build-docs: ## Create sphinx-colorschemed-images documentation. make -C docs clean make -C docs html +debug-docs: ## Create sphinx-colorschemed-images docs with debug enabled. + make -C docs clean + python debug_sphinx.py docs docs/_build -T + serve-lcov: js-tests ## Web server for content from lcov-report directory. python -m http.server -d js/coverage/lcov-report 8193 diff --git a/debug_sphinx.py b/debug_sphinx.py new file mode 100644 index 0000000..5f0e739 --- /dev/null +++ b/debug_sphinx.py @@ -0,0 +1,13 @@ +# Run like: +# +# $ python debug_sphinx.py docs/source docs/build -T +# + +import re +import sys + +from sphinx.cmd.build import main + +if __name__ == "__main__": + sys.argv[0] = re.sub(r"(-script\.pyw?|\.exe)?$", "", sys.argv[0]) + sys.exit(main()) diff --git a/dist/js/sphinx-colorschemed-images.esm.js b/dist/js/sphinx-colorschemed-images.esm.js index ee798ea..07d0493 100644 --- a/dist/js/sphinx-colorschemed-images.esm.js +++ b/dist/js/sphinx-colorschemed-images.esm.js @@ -1,5 +1,5 @@ /*! - * sphinx-colorschemed-images v0.1.3 (https://github.com/danirus/sphinx-colorschemed-images). + * sphinx-colorschemed-images v0.2.1 (https://github.com/danirus/sphinx-colorschemed-images). * Copyright 2024 Daniela Rus Morales. * Licensed under MIT (https://github.com/danirus/sphinx-colorschemed-images/blob/main/LICENSE). */ @@ -66,7 +66,6 @@ var SphinxColorschemeImageHandler = function SphinxColorschemeImageHandler(optio } else if (img.parentElement.tagName == "A" && img.parentElement.getAttribute("href") !== new_src) { var parent = img.parentElement; parent.href = img.getAttribute(data_att); - console.log("the new anchor's href:", parent.href); } }; for (var _iterator = _createForOfIteratorHelperLoose(images), _step; !(_step = _iterator()).done;) { diff --git a/dist/js/sphinx-colorschemed-images.esm.js.map b/dist/js/sphinx-colorschemed-images.esm.js.map index cd4d7ee..eda656f 100644 --- a/dist/js/sphinx-colorschemed-images.esm.js.map +++ b/dist/js/sphinx-colorschemed-images.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"sphinx-colorschemed-images.esm.js","sources":["../../js/src/main.js"],"sourcesContent":["export class SphinxColorschemeImageHandler {\n constructor(options={}) {\n this._schemes = [];\n this._mediaqs = [];\n\n // If options are not given or if it is given with a key 'auto'\n // and a boolean value true, then the instance created will add\n // an event listener for changes on prefers-color-scheme to\n // update images accordingly.\n this._auto = options.hasOwnProperty('auto')\n ? options['auto'] === true\n : true;\n\n const meta_prop = document.querySelector('meta[name=\"color-scheme\"]');\n let meta_schemes = (meta_prop == undefined) ? \"\" : meta_prop.content;\n\n if (meta_schemes.length > 0) {\n const schemes = meta_schemes.split(\" \");\n for (const item of schemes) {\n this._schemes.push(item.trim());\n }\n } else {\n this._schemes = ['light', 'dark'];\n }\n\n for (const scheme of this._schemes) {\n const q = globalThis.matchMedia(`(prefers-color-scheme: ${scheme})`);\n if (q.matches) {\n this.activate(scheme);\n }\n if (this._auto === true) {\n q.addEventListener('change', e => {\n if (e.matches) {\n this.activate(scheme);\n }\n });\n this._mediaqs.push(q);\n }\n }\n }\n\n activate = (scheme) => {\n const data_att = `data-alt-src-color-scheme-${scheme}`;\n const images = document.querySelectorAll(`img[${data_att}]`);\n for (const img of images) {\n const new_img = new Image();\n const new_src = img.getAttribute(data_att);\n new_img.src = new_src;\n new_img.addEventListener('load', () => {\n img.src = new_img.src;\n });\n new_img.addEventListener('error', () => {\n console.error(`Could not replace image ${img.src} with ${new_src}.`);\n });\n if (new_img.complete) {\n img.src = new_img.src;\n }\n\n // Check whether the image is inside a
.\n const figure = img.closest('figure');\n if (figure != undefined) {\n const anchor = figure.querySelector('a');\n if (anchor.getAttribute('href') !== new_src) {\n anchor.href = new_src;\n }\n } else if (\n (img.parentElement.tagName == \"A\")\n && img.parentElement.getAttribute(\"href\") !== new_src\n ) {\n const parent = img.parentElement;\n parent.href = img.getAttribute(data_att);\n console.log(\"the new anchor's href:\", parent.href);\n }\n }\n }\n}\n"],"names":["SphinxColorschemeImageHandler","options","_this","activate","scheme","data_att","images","document","querySelectorAll","_loop","img","_step","value","new_img","Image","new_src","getAttribute","src","addEventListener","console","error","complete","figure","closest","undefined","anchor","querySelector","href","parentElement","tagName","parent","log","_iterator","_createForOfIteratorHelperLoose","done","_schemes","_mediaqs","_auto","hasOwnProperty","meta_prop","meta_schemes","content","length","schemes","split","_iterator2","_step2","item","push","trim","_loop2","_step3","q","globalThis","matchMedia","matches","e","_iterator3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAaA,6BAA6B,GACxC,SAAAA,6BAAAA,CAAYC,OAAO,EAAK;AAAA,EAAA,IAAAC,KAAA,GAAA,IAAA;AAAA,EAAA,IAAZD,OAAO,KAAA,KAAA,CAAA,EAAA;IAAPA,OAAO,GAAC,EAAE;AAAA;AAAA,EAAA,IAAA,CAwCtBE,QAAQ,GAAG,UAACC,MAAM,EAAK;IACrB,IAAMC,QAAQ,kCAAgCD,MAAQ;IACtD,IAAME,MAAM,GAAGC,QAAQ,CAACC,gBAAgB,CAAQH,MAAAA,GAAAA,QAAQ,MAAG,CAAC;IAAC,IAAAI,KAAA,GAAAA,SAAAA,KAAAA,GACnC;AAAA,MAAA,IAAfC,GAAG,GAAAC,KAAA,CAAAC,KAAA;AACZ,MAAA,IAAMC,OAAO,GAAG,IAAIC,KAAK,EAAE;AAC3B,MAAA,IAAMC,OAAO,GAAGL,GAAG,CAACM,YAAY,CAACX,QAAQ,CAAC;MAC1CQ,OAAO,CAACI,GAAG,GAAGF,OAAO;AACrBF,MAAAA,OAAO,CAACK,gBAAgB,CAAC,MAAM,EAAE,YAAM;AACrCR,QAAAA,GAAG,CAACO,GA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,IAAIA,CAAC,CAACD,OAAO,EAAE;AACbrD,UAAAA,KAAI,CAACC,QAAQ,CAACC,MAAM,CAAC;AACvB;AACF,OAAC,CAAC;AACFF,MAAAA,KAAI,CAACkC,QAAQ,CAACY,IAAI,CAACI,CAAC,CAAC;AACvB;GACD;AAbD,EAAA,KAAA,IAAAK,UAAA,GAAAxB,+BAAA,CAAqB,IAAI,CAACE,QAAQ,CAAAgB,EAAAA,MAAA,EAAAA,CAAAA,CAAAA,MAAA,GAAAM,UAAA,IAAAvB,IAAA,GAAA;IAAAgB,MAAA,EAAA;AAAA;AAcpC;;;;"} \ No newline at end of file +{"version":3,"file":"sphinx-colorschemed-images.esm.js","sources":["../../js/src/main.js"],"sourcesContent":["export class SphinxColorschemeImageHandler {\n constructor(options={}) {\n this._schemes = [];\n this._mediaqs = [];\n\n // If options are not given or if it is given with a key 'auto'\n // and a boolean value true, then the instance created will add\n // an event listener for changes on prefers-color-scheme to\n // update images accordingly.\n this._auto = options.hasOwnProperty('auto')\n ? options['auto'] === true\n : true;\n\n const meta_prop = document.querySelector('meta[name=\"color-scheme\"]');\n let meta_schemes = (meta_prop == undefined) ? \"\" : meta_prop.content;\n\n if (meta_schemes.length > 0) {\n const schemes = meta_schemes.split(\" \");\n for (const item of schemes) {\n this._schemes.push(item.trim());\n }\n } else {\n this._schemes = ['light', 'dark'];\n }\n\n for (const scheme of this._schemes) {\n const q = globalThis.matchMedia(`(prefers-color-scheme: ${scheme})`);\n if (q.matches) {\n this.activate(scheme);\n }\n if (this._auto === true) {\n q.addEventListener('change', e => {\n if (e.matches) {\n this.activate(scheme);\n }\n });\n this._mediaqs.push(q);\n }\n }\n }\n\n activate = (scheme) => {\n const data_att = `data-alt-src-color-scheme-${scheme}`;\n const images = document.querySelectorAll(`img[${data_att}]`);\n for (const img of images) {\n const new_img = new Image();\n const new_src = img.getAttribute(data_att);\n new_img.src = new_src;\n new_img.addEventListener('load', () => {\n img.src = new_img.src;\n });\n new_img.addEventListener('error', () => {\n console.error(`Could not replace image ${img.src} with ${new_src}.`);\n });\n if (new_img.complete) {\n img.src = new_img.src;\n }\n\n // Check whether the image is inside a
.\n const figure = img.closest('figure');\n if (figure != undefined) {\n const anchor = figure.querySelector('a');\n if (anchor.getAttribute('href') !== new_src) {\n anchor.href = new_src;\n }\n } else if (\n (img.parentElement.tagName == \"A\")\n && img.parentElement.getAttribute(\"href\") !== new_src\n ) {\n const parent = img.parentElement;\n parent.href = img.getAttribute(data_att);\n }\n }\n }\n}\n"],"names":["SphinxColorschemeImageHandler","options","_this","activate","scheme","data_att","images","document","querySelectorAll","_loop","img","_step","value","new_img","Image","new_src","getAttribute","src","addEventListener","console","error","complete","figure","closest","undefined","anchor","querySelector","href","parentElement","tagName","parent","_iterator","_createForOfIteratorHelperLoose","done","_schemes","_mediaqs","_auto","hasOwnProperty","meta_prop","meta_schemes","content","length","schemes","split","_iterator2","_step2","item","push","trim","_loop2","_step3","q","globalThis","matchMedia","matches","e","_iterator3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAaA,6BAA6B,GACxC,SAAAA,6BAAAA,CAAYC,OAAO,EAAK;AAAA,EAAA,IAAAC,KAAA,GAAA,IAAA;AAAA,EAAA,IAAZD,OAAO,KAAA,KAAA,CAAA,EAAA;IAAPA,OAAO,GAAC,EAAE;AAAA;AAAA,EAAA,IAAA,CAwCtBE,QAAQ,GAAG,UAACC,MAAM,EAAK;IACrB,IAAMC,QAAQ,kCAAgCD,MAAQ;IACtD,IAAME,MAAM,GAAGC,QAAQ,CAACC,gBAAgB,CAAQH,MAAAA,GAAAA,QAAQ,MAAG,CAAC;IAAC,IAAAI,KAAA,GAAAA,SAAAA,KAAAA,GACnC;AAAA,MAAA,IAAfC,GAAG,GAAAC,KAAA,CAAAC,KAAA;AACZ,MAAA,IAAMC,OAAO,GAAG,IAAIC,KAAK,EAAE;AAC3B,MAAA,IAAMC,OAAO,GAAGL,GAAG,CAACM,YAAY,CAACX,QA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AA,CAAC,CAACjC,gBAAgB,CAAC,QAAQ,EAAE,UAAAqC,CAAC,EAAI;QAChC,IAAIA,CAAC,CAACD,OAAO,EAAE;AACbpD,UAAAA,KAAI,CAACC,QAAQ,CAACC,MAAM,CAAC;AACvB;AACF,OAAC,CAAC;AACFF,MAAAA,KAAI,CAACiC,QAAQ,CAACY,IAAI,CAACI,CAAC,CAAC;AACvB;GACD;AAbD,EAAA,KAAA,IAAAK,UAAA,GAAAxB,+BAAA,CAAqB,IAAI,CAACE,QAAQ,CAAAgB,EAAAA,MAAA,EAAAA,CAAAA,CAAAA,MAAA,GAAAM,UAAA,IAAAvB,IAAA,GAAA;IAAAgB,MAAA,EAAA;AAAA;AAcpC;;;;"} \ No newline at end of file diff --git a/dist/js/sphinx-colorschemed-images.js b/dist/js/sphinx-colorschemed-images.js index 3c4247b..2825b82 100644 --- a/dist/js/sphinx-colorschemed-images.js +++ b/dist/js/sphinx-colorschemed-images.js @@ -1,5 +1,5 @@ /*! - * sphinx-colorschemed-images v0.1.3 (https://github.com/danirus/sphinx-colorschemed-images). + * sphinx-colorschemed-images v0.2.1 (https://github.com/danirus/sphinx-colorschemed-images). * Copyright 2024 Daniela Rus Morales. * Licensed under MIT (https://github.com/danirus/sphinx-colorschemed-images/blob/main/LICENSE). */ @@ -71,7 +71,6 @@ } else if (img.parentElement.tagName == "A" && img.parentElement.getAttribute("href") !== new_src) { var parent = img.parentElement; parent.href = img.getAttribute(data_att); - console.log("the new anchor's href:", parent.href); } }; for (var _iterator = _createForOfIteratorHelperLoose(images), _step; !(_step = _iterator()).done;) { diff --git a/dist/js/sphinx-colorschemed-images.js.map b/dist/js/sphinx-colorschemed-images.js.map index 287043b..87caa9c 100644 --- a/dist/js/sphinx-colorschemed-images.js.map +++ b/dist/js/sphinx-colorschemed-images.js.map @@ -1 +1 @@ -{"version":3,"file":"sphinx-colorschemed-images.js","sources":["../../js/src/main.js","../../js/src/script.js"],"sourcesContent":["export class SphinxColorschemeImageHandler {\n constructor(options={}) {\n this._schemes = [];\n this._mediaqs = [];\n\n // If options are not given or if it is given with a key 'auto'\n // and a boolean value true, then the instance created will add\n // an event listener for changes on prefers-color-scheme to\n // update images accordingly.\n this._auto = options.hasOwnProperty('auto')\n ? options['auto'] === true\n : true;\n\n const meta_prop = document.querySelector('meta[name=\"color-scheme\"]');\n let meta_schemes = (meta_prop == undefined) ? \"\" : meta_prop.content;\n\n if (meta_schemes.length > 0) {\n const schemes = meta_schemes.split(\" \");\n for (const item of schemes) {\n this._schemes.push(item.trim());\n }\n } else {\n this._schemes = ['light', 'dark'];\n }\n\n for (const scheme of this._schemes) {\n const q = globalThis.matchMedia(`(prefers-color-scheme: ${scheme})`);\n if (q.matches) {\n this.activate(scheme);\n }\n if (this._auto === true) {\n q.addEventListener('change', e => {\n if (e.matches) {\n this.activate(scheme);\n }\n });\n this._mediaqs.push(q);\n }\n }\n }\n\n activate = (scheme) => {\n const data_att = `data-alt-src-color-scheme-${scheme}`;\n const images = document.querySelectorAll(`img[${data_att}]`);\n for (const img of images) {\n const new_img = new Image();\n const new_src = img.getAttribute(data_att);\n new_img.src = new_src;\n new_img.addEventListener('load', () => {\n img.src = new_img.src;\n });\n new_img.addEventListener('error', () => {\n console.error(`Could not replace image ${img.src} with ${new_src}.`);\n });\n if (new_img.complete) {\n img.src = new_img.src;\n }\n\n // Check whether the image is inside a
.\n const figure = img.closest('figure');\n if (figure != undefined) {\n const anchor = figure.querySelector('a');\n if (anchor.getAttribute('href') !== new_src) {\n anchor.href = new_src;\n }\n } else if (\n (img.parentElement.tagName == \"A\")\n && img.parentElement.getAttribute(\"href\") !== new_src\n ) {\n const parent = img.parentElement;\n parent.href = img.getAttribute(data_att);\n console.log(\"the new anchor's href:\", parent.href);\n }\n }\n }\n}\n","import { SphinxColorschemeImageHandler } from \"./main\";\n\nfunction runWhenDOMContentLoaded(cb) {\n if (document.readyState != 'loading') {\n cb();\n } else if (document.addEventListener) {\n document.addEventListener('DOMContentLoaded', cb);\n } else {\n document.attachEvent('onreadystatechange', function() {\n if (document.readyState == 'complete') cb();\n });\n }\n}\n\nfunction addSphinxColorschemedImageHandler() {\n return new SphinxColorschemeImageHandler();\n}\n\nrunWhenDOMContentLoaded(addSphinxColorschemedImageHandler);\n"],"names":["SphinxColorschemeImageHandler","options","_this","activate","scheme","data_att","images","document","querySelectorAll","_loop","img","_step","value","new_img","Image","new_src","getAttribute","src","addEventListener","console","error","complete","figure","closest","undefined","anchor","querySelector","href","parentElement","tagName","parent","log","_iterator","_createForOfIteratorHelperLoose","done","_schemes","_mediaqs","_auto","hasOwnProperty","meta_prop","meta_schemes","content","length","schemes","split","_iterator2","_step2","item","push","trim","_loop2","_step3","q","globalThis","matchMedia","matches","e","_iterator3","runWhenDOMContentLoaded","cb","readyState","attachEvent","addSphinxColorschemedImageHandler"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA,IAAaA,6BAA6B,GACxC,SAAAA,6BAAAA,CAAYC,OAAO,EAAK;EAAA,EAAA,IAAAC,KAAA,GAAA,IAAA;EAAA,EAAA,IAAZD,OAAO,KAAA,KAAA,CAAA,EAAA;MAAPA,OAAO,GAAC,EAAE;EAAA;EAAA,EAAA,IAAA,CAwCtBE,QAAQ,GAAG,UAACC,MAAM,EAAK;MACrB,IAAMC,QAAQ,kCAAgCD,MAAQ;MACtD,IAAME,MAAM,GAAGC,QAAQ,CAACC,gBAAgB,CAAQH,MAAAA,GAAAA,QAAQ,MAAG,CAAC;MAAC,IAAAI,KAAA,GAAAA,SAAAA,KAAAA,GACnC;EAAA,MAAA,IAAfC,GAAG,GAAAC,KAAA,CAAAC,KAAA;EACZ,MAAA,IAAMC,OAAO,GAAG,IAAIC,KAAK,EAAE;EAC3B,MAAA,IAAMC,OAAO,GAAGL,GAAG,CAACM,YAAY,CAACX,QAAQ,CAAC;QAC1CQ,OAAO,CAACI,GAAG,GAAGF,OAAO;EACrBF,MAAAA,OAAO,CAACK,gBAAgB,CAAC,M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,CAAC,QAAQ,EAAE,UAAAsC,CAAC,EAAI;UAChC,IAAIA,CAAC,CAACD,OAAO,EAAE;EACbrD,UAAAA,KAAI,CAACC,QAAQ,CAACC,MAAM,CAAC;EACvB;EACF,OAAC,CAAC;EACFF,MAAAA,KAAI,CAACkC,QAAQ,CAACY,IAAI,CAACI,CAAC,CAAC;EACvB;KACD;EAbD,EAAA,KAAA,IAAAK,UAAA,GAAAxB,+BAAA,CAAqB,IAAI,CAACE,QAAQ,CAAAgB,EAAAA,MAAA,EAAAA,CAAAA,CAAAA,MAAA,GAAAM,UAAA,IAAAvB,IAAA,GAAA;MAAAgB,MAAA,EAAA;EAAA;EAcpC,CAAC;;ECrCH,SAASQ,uBAAuBA,CAACC,EAAE,EAAE;EACnC,EAAA,IAAIpD,QAAQ,CAACqD,UAAU,IAAI,SAAS,EAAE;EACpCD,IAAAA,EAAE,EAAE;EACN,GAAC,MAAM,IAAIpD,QAAQ,CAACW,gBAAgB,EAAE;EACpCX,IAAAA,QAAQ,CAACW,gBAAgB,CAAC,kBAAkB,EAAEyC,EAAE,CAAC;EACnD,GAAC,MAAM;EACLpD,IAAAA,QAAQ,CAACsD,WAAW,CAAC,oBAAoB,EAAE,YAAW;QACpD,IAAItD,QAAQ,CAACqD,UAAU,IAAI,UAAU,EAAED,EAAE,EAAE;EAC7C,KAAC,CAAC;EACJ;EACF;EAEA,SAASG,iCAAiCA,GAAG;IAC3C,OAAO,IAAI9D,6BAA6B,EAAE;EAC5C;EAEA0D,uBAAuB,CAACI,iCAAiC,CAAC;;;;;;"} \ No newline at end of file +{"version":3,"file":"sphinx-colorschemed-images.js","sources":["../../js/src/main.js","../../js/src/script.js"],"sourcesContent":["export class SphinxColorschemeImageHandler {\n constructor(options={}) {\n this._schemes = [];\n this._mediaqs = [];\n\n // If options are not given or if it is given with a key 'auto'\n // and a boolean value true, then the instance created will add\n // an event listener for changes on prefers-color-scheme to\n // update images accordingly.\n this._auto = options.hasOwnProperty('auto')\n ? options['auto'] === true\n : true;\n\n const meta_prop = document.querySelector('meta[name=\"color-scheme\"]');\n let meta_schemes = (meta_prop == undefined) ? \"\" : meta_prop.content;\n\n if (meta_schemes.length > 0) {\n const schemes = meta_schemes.split(\" \");\n for (const item of schemes) {\n this._schemes.push(item.trim());\n }\n } else {\n this._schemes = ['light', 'dark'];\n }\n\n for (const scheme of this._schemes) {\n const q = globalThis.matchMedia(`(prefers-color-scheme: ${scheme})`);\n if (q.matches) {\n this.activate(scheme);\n }\n if (this._auto === true) {\n q.addEventListener('change', e => {\n if (e.matches) {\n this.activate(scheme);\n }\n });\n this._mediaqs.push(q);\n }\n }\n }\n\n activate = (scheme) => {\n const data_att = `data-alt-src-color-scheme-${scheme}`;\n const images = document.querySelectorAll(`img[${data_att}]`);\n for (const img of images) {\n const new_img = new Image();\n const new_src = img.getAttribute(data_att);\n new_img.src = new_src;\n new_img.addEventListener('load', () => {\n img.src = new_img.src;\n });\n new_img.addEventListener('error', () => {\n console.error(`Could not replace image ${img.src} with ${new_src}.`);\n });\n if (new_img.complete) {\n img.src = new_img.src;\n }\n\n // Check whether the image is inside a
.\n const figure = img.closest('figure');\n if (figure != undefined) {\n const anchor = figure.querySelector('a');\n if (anchor.getAttribute('href') !== new_src) {\n anchor.href = new_src;\n }\n } else if (\n (img.parentElement.tagName == \"A\")\n && img.parentElement.getAttribute(\"href\") !== new_src\n ) {\n const parent = img.parentElement;\n parent.href = img.getAttribute(data_att);\n }\n }\n }\n}\n","import { SphinxColorschemeImageHandler } from \"./main\";\n\nfunction runWhenDOMContentLoaded(cb) {\n if (document.readyState != 'loading') {\n cb();\n } else if (document.addEventListener) {\n document.addEventListener('DOMContentLoaded', cb);\n } else {\n document.attachEvent('onreadystatechange', function() {\n if (document.readyState == 'complete') cb();\n });\n }\n}\n\nfunction addSphinxColorschemedImageHandler() {\n return new SphinxColorschemeImageHandler();\n}\n\nrunWhenDOMContentLoaded(addSphinxColorschemedImageHandler);\n"],"names":["SphinxColorschemeImageHandler","options","_this","activate","scheme","data_att","images","document","querySelectorAll","_loop","img","_step","value","new_img","Image","new_src","getAttribute","src","addEventListener","console","error","complete","figure","closest","undefined","anchor","querySelector","href","parentElement","tagName","parent","_iterator","_createForOfIteratorHelperLoose","done","_schemes","_mediaqs","_auto","hasOwnProperty","meta_prop","meta_schemes","content","length","schemes","split","_iterator2","_step2","item","push","trim","_loop2","_step3","q","globalThis","matchMedia","matches","e","_iterator3","runWhenDOMContentLoaded","cb","readyState","attachEvent","addSphinxColorschemedImageHandler"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA,IAAaA,6BAA6B,GACxC,SAAAA,6BAAAA,CAAYC,OAAO,EAAK;EAAA,EAAA,IAAAC,KAAA,GAAA,IAAA;EAAA,EAAA,IAAZD,OAAO,KAAA,KAAA,CAAA,EAAA;MAAPA,OAAO,GAAC,EAAE;EAAA;EAAA,EAAA,IAAA,CAwCtBE,QAAQ,GAAG,UAACC,MAAM,EAAK;MACrB,IAAMC,QAAQ,kCAAgCD,MAAQ;MACtD,IAAME,MAAM,GAAGC,QAAQ,CAACC,gBAAgB,CAAQH,MAAAA,GAAAA,QAAQ,MAAG,CAAC;MAAC,IAAAI,KAAA,GAAAA,SAAAA,KAAAA,GACnC;EAAA,MAAA,IAAfC,GAAG,GAAAC,KAAA,CAAAC,KAAA;EACZ,MAAA,IAAMC,OAAO,GAAG,IAAIC,KAAK,EAAE;EAC3B,MAAA,IAAMC,OAAO,GAAGL,GAAG,CAACM,YAAY,CAACX,QAAQ,CAAC;QAC1CQ,OAAO,CAACI,GAAG,GAAGF,OAAO;EACrBF,MAAAA,OAAO,CAACK,gBAAgB,CAAC,MAAM,EAAE,YAAM;EACrCR,QAAAA,GAAG,CAACO,GAAG,GAAGJ,OAAO,CAACI,GAAG;EACvB,OAAC,CAAC;EACFJ,MAAAA,OAAO,CAACK,gBAAgB,CAAC,OAAO,EAAE,YAAM;UACtCC,OAAO,CAACC,KAAK,CAA4BV,0B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GAAAxB,+BAAA,CAAqB,IAAI,CAACE,QAAQ,CAAAgB,EAAAA,MAAA,EAAAA,CAAAA,CAAAA,MAAA,GAAAM,UAAA,IAAAvB,IAAA,GAAA;MAAAgB,MAAA,EAAA;EAAA;EAcpC,CAAC;;ECrCH,SAASQ,uBAAuBA,CAACC,EAAE,EAAE;EACnC,EAAA,IAAInD,QAAQ,CAACoD,UAAU,IAAI,SAAS,EAAE;EACpCD,IAAAA,EAAE,EAAE;EACN,GAAC,MAAM,IAAInD,QAAQ,CAACW,gBAAgB,EAAE;EACpCX,IAAAA,QAAQ,CAACW,gBAAgB,CAAC,kBAAkB,EAAEwC,EAAE,CAAC;EACnD,GAAC,MAAM;EACLnD,IAAAA,QAAQ,CAACqD,WAAW,CAAC,oBAAoB,EAAE,YAAW;QACpD,IAAIrD,QAAQ,CAACoD,UAAU,IAAI,UAAU,EAAED,EAAE,EAAE;EAC7C,KAAC,CAAC;EACJ;EACF;EAEA,SAASG,iCAAiCA,GAAG;IAC3C,OAAO,IAAI7D,6BAA6B,EAAE;EAC5C;EAEAyD,uBAAuB,CAACI,iCAAiC,CAAC;;;;;;"} \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 2b27a7a..8bfe1ff 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -41,9 +41,9 @@ today_fmt = '%A %d. %B %Y, %H:%M' -html_theme = "sphinx_nefertiti" - html_theme = 'sphinx_nefertiti' +html_style = ["custom.css"] + html_static_path = ['static'] html_favicon = "static/diamond-half.svg" @@ -71,6 +71,17 @@ for item in releases ], + "header_links": [ + { + "text": "Home", + "link": "index", + }, + { + "text": "Release Notes", + "link": "release-notes", + } + ], + "footer_links": [ { "text": "Documentation", diff --git a/docs/release-notes.md b/docs/release-notes.md new file mode 100644 index 0000000..ad018c0 --- /dev/null +++ b/docs/release-notes.md @@ -0,0 +1,6 @@ +--- +orphan: true +--- + +```{include} ../ChangeLog.md +``` diff --git a/docs/static/custom.css b/docs/static/custom.css new file mode 100644 index 0000000..4a5f34c --- /dev/null +++ b/docs/static/custom.css @@ -0,0 +1,4 @@ +html.dark { + --sd-color-tabs-overline: rgba(173, 181, 189, 0.175); + --sd-color-tabs-underline: rgba(173, 181, 189, 0.175); +} diff --git a/package.json b/package.json index 1b19a97..3a317e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sphinx-colorschemed-images", - "version": "0.2.0", + "version": "0.2.1", "description": "Include color-scheme aware images in Sphinx projects.", "repository": { "type": "git", diff --git a/pyproject.toml b/pyproject.toml index 24b17c6..0a537cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,8 +33,9 @@ docs = [ "sphinx >=8.1.3, <8.2", "myst-parser >=4.0.0, <4.1", "sphinx-design >=0.6.1, <0.7", + "sphinx-colorschemed-images >= 0.2.1", "sphinx_copybutton >=0.5.2, <1.0.0", - "sphinx-nefertiti >=0.5", + "sphinx-nefertiti >=0.5.1", ] [tool.setuptools] diff --git a/sphinx_colorschemed_images/__init__.py b/sphinx_colorschemed_images/__init__.py index ba8225e..ec5fc69 100644 --- a/sphinx_colorschemed_images/__init__.py +++ b/sphinx_colorschemed_images/__init__.py @@ -2,7 +2,7 @@ from .extension import copy_colorschemed_images, extension_builder_inited -__version__ = "0.2.0" +__version__ = "0.2.1" def setup(app) -> dict: diff --git a/sphinx_colorschemed_images/extension.py b/sphinx_colorschemed_images/extension.py index f32d037..8041e0d 100644 --- a/sphinx_colorschemed_images/extension.py +++ b/sphinx_colorschemed_images/extension.py @@ -183,7 +183,7 @@ def copy_colorschemed_images(app, *args): images = dict(app.env.colorschemed_images) images_dir = Path(app.builder.imagedir) - ensuredir(images_dir) + ensuredir(app.outdir / images_dir) stringify_func = ImageAdapter(app.env).get_original_image_uri for src in status_iterator( @@ -194,7 +194,6 @@ def copy_colorschemed_images(app, *args): app.verbosity, stringify_func=stringify_func, ): - # import ipdb; ipdb.set_trace() dest = images[src] try: copyfile(