diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:57:07 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:57:07 +0000 |
commit | 46fc0a4b3dccce58c429f408c04cf5cda3af9fb5 (patch) | |
tree | 410d83c434319e0c6f8035cdfa60ae8957b1d909 /tests/roots/test-util-copyasset_overwrite/myext.py | |
parent | Adding upstream version 7.3.7. (diff) | |
download | sphinx-46fc0a4b3dccce58c429f408c04cf5cda3af9fb5.tar.xz sphinx-46fc0a4b3dccce58c429f408c04cf5cda3af9fb5.zip |
Adding upstream version 7.4.7.upstream/7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/roots/test-util-copyasset_overwrite/myext.py')
-rw-r--r-- | tests/roots/test-util-copyasset_overwrite/myext.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/roots/test-util-copyasset_overwrite/myext.py b/tests/roots/test-util-copyasset_overwrite/myext.py new file mode 100644 index 0000000..544057c --- /dev/null +++ b/tests/roots/test-util-copyasset_overwrite/myext.py @@ -0,0 +1,22 @@ +from pathlib import Path + +from sphinx.util.fileutil import copy_asset + + +def _copy_asset_overwrite_hook(app): + css = app.outdir / '_static' / 'custom-styles.css' + # html_static_path is copied by default + assert css.read_text() == '/* html_static_path */\n', 'invalid default text' + # warning generated by here + copy_asset( + Path(__file__).parent.joinpath('myext_static', 'custom-styles.css'), + app.outdir / '_static', + ) + # This demonstrates the overwriting + assert css.read_text() == '/* extension styles */\n', 'overwriting failed' + return [] + + +def setup(app): + app.connect('html-collect-pages', _copy_asset_overwrite_hook) + app.add_css_file('custom-styles.css') |