From 2615366109531bad2cf0f80d683f00ff58997d0d Mon Sep 17 00:00:00 2001 From: Jared Dillard Date: Sun, 27 Oct 2024 17:02:06 -0700 Subject: [PATCH 1/3] DOC: Add copy_asset and copy_asset_file to extdev/utils --- doc/extdev/utils.rst | 3 +++ sphinx/util/fileutil.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/extdev/utils.rst b/doc/extdev/utils.rst index 9e10a0ded85..879ffee1b4a 100644 --- a/doc/extdev/utils.rst +++ b/doc/extdev/utils.rst @@ -44,6 +44,9 @@ Utility functions .. autofunction:: sphinx.util.parsing.nested_parse_to_nodes +.. autofunction:: sphinx.util.fileutil.copy_asset + +.. autofunction:: sphinx.util.fileutil.copy_asset_file Utility types ------------- diff --git a/sphinx/util/fileutil.py b/sphinx/util/fileutil.py index acd52b07674..3e4d5c7c567 100644 --- a/sphinx/util/fileutil.py +++ b/sphinx/util/fileutil.py @@ -53,6 +53,8 @@ def copy_asset_file( :param context: The template variables. If not given, template files are simply copied :param renderer: The template engine. If not given, SphinxRenderer is used by default :param bool force: Overwrite the destination file even if it exists. + + .. versionadded:: 1.5 """ if not os.path.exists(source): return @@ -115,7 +117,7 @@ def copy_asset( On copying, it expands the template variables if context argument is given and the asset is a template file. - Use ``copy_asset_file`` instead to copy a single file. + Use :func:`copy_asset_file` instead to copy a single file. :param source: The path to source file or directory :param destination: The path to destination directory @@ -124,6 +126,8 @@ def copy_asset( :param renderer: The template engine. If not given, SphinxRenderer is used by default :param onerror: The error handler. :param bool force: Overwrite the destination file even if it exists. + + .. versionadded:: 1.5 """ if not os.path.exists(source): return From 810b66304bb8836ea95fd1c88789417648626883 Mon Sep 17 00:00:00 2001 From: Jared Dillard Date: Sun, 27 Oct 2024 17:32:01 -0700 Subject: [PATCH 2/3] Add BaseRenderer class to nitpick_ignore --- doc/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/conf.py b/doc/conf.py index e7976f59a87..891ed0eebed 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -198,6 +198,7 @@ ('py:class', 'Path'), # sphinx.application.Sphinx.connect ('py:class', 'RoleFunction'), # sphinx.domains.Domain ('py:class', 'RSTState'), # sphinx.utils.parsing.nested_parse_to_nodes + ('py:class', 'BaseRenderer'), # sphinx.utils.fileutil.copy_asset_file ('py:class', 'Theme'), # sphinx.application.TemplateBridge ('py:class', 'SearchLanguage'), # sphinx.application.Sphinx.add_search_language ('py:class', 'StringList'), # sphinx.utils.parsing.nested_parse_to_nodes From 7f9c53cc911dcee62ad0d2e0134345119409d5e3 Mon Sep 17 00:00:00 2001 From: Jared Dillard Date: Sun, 3 Nov 2024 22:29:28 -0800 Subject: [PATCH 3/3] Update doc/extdev/utils.rst Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- doc/extdev/utils.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/extdev/utils.rst b/doc/extdev/utils.rst index 879ffee1b4a..4eeec0394f1 100644 --- a/doc/extdev/utils.rst +++ b/doc/extdev/utils.rst @@ -44,10 +44,10 @@ Utility functions .. autofunction:: sphinx.util.parsing.nested_parse_to_nodes -.. autofunction:: sphinx.util.fileutil.copy_asset - .. autofunction:: sphinx.util.fileutil.copy_asset_file +.. autofunction:: sphinx.util.fileutil.copy_asset + Utility types -------------