Repository: sphinx-doc/sphinx

Issue:
Messaging improvement: mention template evaluation during file copying
### Describe the bug

The messaging of [`copying static files`](https://github.com/sphinx-doc/sphinx/blob/b6e6805f80ad530231cf841e689498005cf2bb96/sphinx/builders/html/__init__.py#L862) can be inaccurate in cases where Sphinx copies content that includes templated files (because those are evaluated by `jinja` and the results are written instead of the original template's contents).

This may be rare, but it's particularly incongruous messaging when builds treat warnings as failures, as seen here: https://github.com/astropy/sphinx-automodapi/actions/runs/4694556705/jobs/8322825594#step:8:170

```
copying static files... failed
...
Failed to copy a file in html_static_file: /home/runner/work/sphinx-automodapi/sphinx-automodapi/.tox/py310-test-sphinxdev/lib/python3.10/site-packages/alabaster/static/alabaster.css_t: OldJinjaSuffixWarning("'/home/runner/work/sphinx-automodapi/sphinx-automodapi/.tox/py310-test-sphinxdev/lib/python3.10/site-packages/alabaster/static/alabaster.css_t': the '_t' suffix for Jinja templates is deprecated. If the file is a template, use the suffix '.jinja' instead. For more information, see https://www.sphinx-doc.org/en/master/development/theming.html#static-templates")
```

As a possible improvement I'd suggest `copying static files and evaluating Jinja templates`.

### How to Reproduce

Invoking the `sphinx-build -b html . _build` command to build a Sphinx project as HTML emits this message as part of the output.

### Environment Information

```text
Platform:              linux; (Linux-6.1.0-7-amd64-x86_64-with-glibc2.36)
Python version:        3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0])
Python implementation: CPython
Sphinx version:        6.2.0+/b6e6805f8
Docutils version:      0.19
Jinja2 version:        3.1.2
Pygments version:      2.15.0
```


### Sphinx extensions

```python
N/A
```


### Additional context

Localisation of the updated message will be required.


Discussion:

Patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index 4b920ca3911..c7bc72390cd 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -13,6 +13,9 @@ Deprecated
 Features added
 --------------
 
+* #11328: Mention evaluation of templated content during production of static
+  output files.
+
 Bugs fixed
 ----------
 
diff --git a/sphinx/builders/html/__init__.py b/sphinx/builders/html/__init__.py
index 06917232f6b..23e19ed4733 100644
--- a/sphinx/builders/html/__init__.py
+++ b/sphinx/builders/html/__init__.py
@@ -887,7 +887,7 @@ def copy_html_favicon(self) -> None:
 
     def copy_static_files(self) -> None:
         try:
-            with progress_message(__('copying static files')):
+            with progress_message(__('copying static files'), nonl=False):
                 ensuredir(self.outdir / '_static')
 
                 # prepare context for templates
@@ -908,7 +908,7 @@ def copy_static_files(self) -> None:
     def copy_extra_files(self) -> None:
         """Copy html_extra_path files."""
         try:
-            with progress_message(__('copying extra files')):
+            with progress_message(__('copying extra files'), nonl=False):
                 excluded = Matcher(self.config.exclude_patterns)
                 for extra_path in self.config.html_extra_path:
                     copy_asset(
diff --git a/sphinx/util/fileutil.py b/sphinx/util/fileutil.py
index 1996a7af846..259a2af1952 100644
--- a/sphinx/util/fileutil.py
+++ b/sphinx/util/fileutil.py
@@ -81,6 +81,9 @@ def copy_asset_file(source: str | os.PathLike[str], destination: str | os.PathLi
 
         destination = _template_basename(destination) or destination
         with open(destination, 'w', encoding='utf-8') as fdst:
+            msg = __('Writing evaluated template result to %s')
+            logger.info(msg, os.fsdecode(destination), type='misc',
+                        subtype='template_evaluation')
             fdst.write(rendered_template)
     else:
         copyfile(source, destination, force=force)


Test patch:
diff --git a/tests/test_util/test_util_fileutil.py b/tests/test_util/test_util_fileutil.py
index 2ba21a41e8e..16ace8a249b 100644
--- a/tests/test_util/test_util_fileutil.py
+++ b/tests/test_util/test_util_fileutil.py
@@ -1,5 +1,6 @@
 """Tests sphinx.util.fileutil functions."""
 
+import re
 from unittest import mock
 
 import pytest
@@ -106,6 +107,14 @@ def excluded(path):
     assert not (destdir / '_templates' / 'sidebar.html').exists()
 
 
+@pytest.mark.sphinx('html', testroot='html_assets')
+def test_copy_asset_template(app):
+    app.build(force_all=True)
+
+    expected_msg = r"^Writing evaluated template result to [^\n]*\bAPI.html$"
+    assert re.findall(expected_msg, strip_colors(app.status.getvalue()), flags=re.MULTILINE)
+
+
 @pytest.mark.sphinx('html', testroot='util-copyasset_overwrite')
 def test_copy_asset_overwrite(app):
     app.build()