We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Bug]: The documentation does not correctly indicate the last release information
### What happened?

should show `whatsnew` correctly

### What did you expect to happen?

_No response_

### Minimal Complete Verifiable Example

_No response_

### Relevant log output

_No response_

### Anything else we need to know?

_No response_

### Environment

N.A.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `.ci/update_version_and_release_notes.py`
Content:
```
1 import json
2 import re
3 import sys
4 from datetime import date
5 from pathlib import Path
6 
7 import yaml
8 from cffconvert.cli.create_citation import create_citation
9 from setuptools_scm import get_version
10 
11 CI = Path(__file__).parent
12 PROJECT = CI.parent
13 CITATION = PROJECT / "CITATION.cff"
14 ZENODO = PROJECT / ".zenodo.json"
15 DOCS = PROJECT / "docs"
16 WN = DOCS / "whatsnew"
17 
18 gitversion = get_version(root="..", relative_to=__file__)
19 
20 
21 class Zenodo:
22     def __init__(self, infile=ZENODO):
23         self._infile = infile
24         self._js = None
25 
26     def load(self):
27         """
28         Load the .zenodo.json file
29         """
30         with self._infile.open("r") as fid:
31             self._js = json.load(fid)
32 
33     def save(self):
34         """
35         Write the .zenodo.json file
36         """
37         with self._infile.open("w") as fid:
38             json.dump(self._js, fid, indent=2)
39             fid.write("\n")  # add a trailing blank line for pre-commit compat.
40 
41     def update_date(self):
42         """
43         Update the publication date metadata
44         """
45         self._js["publication_date"] = date.today().isoformat()
46 
47     def update_version(self, version=None):
48         """
49         Update the version string metadata
50         """
51         if version is None:
52             version = gitversion
53         self._js["version"] = ".".join(version.split(".")[:3])
54 
55     def __str__(self):
56         return json.dumps(self._js, indent=2)
57 
58 
59 class Citation:
60     def __init__(self, infile=CITATION):
61         self._infile = infile
62         self._citation = None
63 
64     def __getattr__(self, key):
65         if not self._citation:
66             self.load()
67         self._outputformat = {
68             "apa": self._citation.as_apalike,
69             "bibtex": self._citation.as_bibtex,
70             "cff": self._citation.as_cff,
71             "endnote": self._citation.as_endnote,
72             "ris": self._citation.as_ris,
73         }
74         if key in self._outputformat.keys():
75             return self.format(key)
76         raise AttributeError
77 
78     def load(self):
79         """
80         Load the CITATION.cff file
81         """
82         self._citation = create_citation(self._infile, url=None)
83         try:
84             self._citation.validate()
85         except Exception as e:
86             raise ImportError(e)
87 
88     def save(self):
89         """
90         Write the CITATION.cff file
91         """
92         with self._infile.open("w") as fid:
93             fid.write(yaml.dump(self._citation.cffobj, indent=2))
94 
95     def __str__(self):
96         return self.apa
97 
98     def format(self, fmt="apa"):
99         """
100         Return a str with citation in the given format
101 
102         Parameters
103         ----------
104         fmt : str, optional, default: "apa"
105             Output format: "apa', "bibtex", "cff", "endnote" or "ris"
106 
107         Return
108         ------
109         str
110             The citation in the given format
111 
112         Examples
113         --------
114 
115         >>> citation = Citation()
116         >>> apa = citation.format("apa")
117 
118         It is also possible to directly get the desired format using the name of the
119         attribute:
120         e.g.,
121 
122         >>> apa = citation.apa
123 
124         By default, printing, citation result is done with the apa format:
125 
126         >>> print(citation)
127         Travert A., Fernandez C. ...
128         """
129         return self._outputformat[fmt]()
130 
131     def update_date(self):
132         """
133         Update the released-date metadata .
134         """
135         self._citation.cffobj["date-released"] = date.today().isoformat()
136 
137     def update_version(self, version=None):
138         """
139         Update the version metadata.
140         """
141         if version is None:
142             version = gitversion
143         self._citation.cffobj["version"] = ".".join(version.split(".")[:3])
144 
145 
146 def make_citation(version):
147     """"""
148     citation = Citation()
149     citation.load()
150     citation.update_version(version)
151     citation.update_date()
152     print(citation)
153     citation.save()
154 
155 
156 def make_zenodo(version):
157     """"""
158     zenodo = Zenodo()
159     zenodo.load()
160     zenodo.update_version(version)
161     zenodo.update_date()
162     print(zenodo)
163     zenodo.save()
164 
165 
166 def make_release_note_index(revision):
167 
168     # remove old rev files
169     files = WN.glob("v*.dev*.rst")
170     for file in files:
171         file.unlink()
172     if (WN / "latest.rst").exists():
173         (WN / "latest.rst").unlink()
174 
175     # Create or update file with the current version number
176     if revision == "unreleased":
177         revision = gitversion.split("+")[0]
178 
179     content = (WN / "changelog.rst").read_text()
180 
181     sections = re.split(r"^\.\. section$", content, flags=re.M)
182 
183     # remove void sections and clean other sections
184     header = re.sub(r"(\.\.\n(.*\n)*)", "", sections[0], 0)
185     header = header.strip() + "\n"
186     cleaned_sections = [
187         header,
188     ]
189     for section in sections[1:]:
190         if section.strip().endswith("(do not delete this comment)"):
191             continue
192         content = re.sub(
193             r"(\.\. Add.*\(do not delete this comment\)\n)", "", section, 0
194         )
195         content = content.strip() + "\n"
196         cleaned_sections.append(content)
197 
198     changelog_content = "\n".join(cleaned_sections)
199     # changelog_content = changelog_content.strip() + "\n"  # end of file
200     changelog_content = changelog_content.replace("{{ revision }}", revision)
201 
202     if ".dev" in revision:
203         (WN / "latest.rst").write_text(changelog_content)
204     else:
205         # in principle this happens for release, create the related rst file
206         (WN / f"v{revision}.rst").write_text(changelog_content)
207         # void changelog (keep only section titles)
208         (WN / "changelog.rst").write_text(
209             """
210 What's new in revision {{ revision }}
211 ---------------------------------------------------------------------------------------
212 
213 These are the changes in SpectroChemPy-{{ revision }}.
214 See :ref:`release` for a full changelog including other versions of SpectroChemPy.
215 
216 ..
217    Do not remove the ``revision`` marker. It will be replaced during doc building.
218    Also do not delete the section titles.
219    Add your list of changes between (Add here) and (section) comments
220    keeping a blank line before and after this list.
221 
222 
223 .. section
224 
225 New features
226 ~~~~~~~~~~~~
227 .. Add here new public features (do not delete this comment)
228 
229 
230 .. section
231 
232 Bug fixes
233 ~~~~~~~~~
234 .. Add here new bug fixes (do not delete this comment)
235 
236 
237 .. section
238 
239 Breaking changes
240 ~~~~~~~~~~~~~~~~
241 .. Add here new breaking changes (do not delete this comment)
242 
243 
244 .. section
245 
246 Deprecations
247 ~~~~~~~~~~~~
248 .. Add here new deprecations (do not delete this comment)
249 """
250         )
251     # Create the new index.rst file
252     files = WN.glob("v*.rst")
253     names = []
254     for file in files:
255         name = file.name
256         names.append(name)
257     names.sort()
258     names.reverse()
259     dicvers = {}
260     for name in names:
261         arr = name.split(".")
262         base = ".".join(arr[:3])
263         v = f"{arr[0][1]}.{arr[1]}"
264         if v in dicvers:
265             dicvers[v].append(base)
266         else:
267             dicvers[v] = [base]
268 
269     with open(WN / "index.rst", "w") as f:
270         f.write(
271             """.. _release:
272 
273 ..
274    Do not modify this file as it is automatically generated.
275    See '.ci/update_version_and_release_notes.py' if you need to change the output.
276 
277 *************
278 Release notes
279 *************
280 
281 This is the list of changes to `SpectroChemPy` between each release. For full details,
282 see the `commit logs <https://github.com/spectrochempy/spectrochempy/commits/>`_ .
283 For install and upgrade instructions, see :ref:`installation`\ .
284 """
285         )
286         for i, vers in enumerate(dicvers):
287             latest = "\n    latest" if i == 0 and ".dev" in revision else ""
288             f.write(
289                 f"""
290 Version {vers}
291 --------------
292 
293 .. toctree::
294     :maxdepth: 2
295 {latest}
296 """
297             )
298             li = sorted(dicvers[vers], key=lambda x: int(str.split(x, ".")[2]))
299             li.reverse()
300             for rev in li:
301                 f.write(f"    {rev}\n")
302 
303 
304 if __name__ == "__main__":
305 
306     if len(sys.argv) > 1:
307         new_revision = sys.argv[1]
308     else:
309         new_revision = "unreleased"
310 
311     if new_revision != "unreleased":
312         make_citation(new_revision)
313         make_zenodo(new_revision)
314 
315     make_release_note_index(new_revision)
316
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/.ci/update_version_and_release_notes.py b/.ci/update_version_and_release_notes.py
--- a/.ci/update_version_and_release_notes.py
+++ b/.ci/update_version_and_release_notes.py
@@ -165,7 +165,7 @@
 
 def make_release_note_index(revision):
 
-    # remove old rev files
+    # remove old last revision files
     files = WN.glob("v*.dev*.rst")
     for file in files:
         file.unlink()
@@ -207,6 +207,8 @@
         # void changelog (keep only section titles)
         (WN / "changelog.rst").write_text(
             """
+:orphan:
+
 What's new in revision {{ revision }}
 ---------------------------------------------------------------------------------------

{"golden_diff": "diff --git a/.ci/update_version_and_release_notes.py b/.ci/update_version_and_release_notes.py\n--- a/.ci/update_version_and_release_notes.py\n+++ b/.ci/update_version_and_release_notes.py\n@@ -165,7 +165,7 @@\n \n def make_release_note_index(revision):\n \n-    # remove old rev files\n+    # remove old last revision files\n     files = WN.glob(\"v*.dev*.rst\")\n     for file in files:\n         file.unlink()\n@@ -207,6 +207,8 @@\n         # void changelog (keep only section titles)\n         (WN / \"changelog.rst\").write_text(\n             \"\"\"\n+:orphan:\n+\n What's new in revision {{ revision }}\n ---------------------------------------------------------------------------------------\n", "issue": "[Bug]: The documentation does not correctly indicate the last release information\n### What happened?\n\nshould show `whatsnew` correctly\n\n### What did you expect to happen?\n\n_No response_\n\n### Minimal Complete Verifiable Example\n\n_No response_\n\n### Relevant log output\n\n_No response_\n\n### Anything else we need to know?\n\n_No response_\n\n### Environment\n\nN.A.\n", "before_files": [{"content": "import json\nimport re\nimport sys\nfrom datetime import date\nfrom pathlib import Path\n\nimport yaml\nfrom cffconvert.cli.create_citation import create_citation\nfrom setuptools_scm import get_version\n\nCI = Path(__file__).parent\nPROJECT = CI.parent\nCITATION = PROJECT / \"CITATION.cff\"\nZENODO = PROJECT / \".zenodo.json\"\nDOCS = PROJECT / \"docs\"\nWN = DOCS / \"whatsnew\"\n\ngitversion = get_version(root=\"..\", relative_to=__file__)\n\n\nclass Zenodo:\n    def __init__(self, infile=ZENODO):\n        self._infile = infile\n        self._js = None\n\n    def load(self):\n        \"\"\"\n        Load the .zenodo.json file\n        \"\"\"\n        with self._infile.open(\"r\") as fid:\n            self._js = json.load(fid)\n\n    def save(self):\n        \"\"\"\n        Write the .zenodo.json file\n        \"\"\"\n        with self._infile.open(\"w\") as fid:\n            json.dump(self._js, fid, indent=2)\n            fid.write(\"\\n\")  # add a trailing blank line for pre-commit compat.\n\n    def update_date(self):\n        \"\"\"\n        Update the publication date metadata\n        \"\"\"\n        self._js[\"publication_date\"] = date.today().isoformat()\n\n    def update_version(self, version=None):\n        \"\"\"\n        Update the version string metadata\n        \"\"\"\n        if version is None:\n            version = gitversion\n        self._js[\"version\"] = \".\".join(version.split(\".\")[:3])\n\n    def __str__(self):\n        return json.dumps(self._js, indent=2)\n\n\nclass Citation:\n    def __init__(self, infile=CITATION):\n        self._infile = infile\n        self._citation = None\n\n    def __getattr__(self, key):\n        if not self._citation:\n            self.load()\n        self._outputformat = {\n            \"apa\": self._citation.as_apalike,\n            \"bibtex\": self._citation.as_bibtex,\n            \"cff\": self._citation.as_cff,\n            \"endnote\": self._citation.as_endnote,\n            \"ris\": self._citation.as_ris,\n        }\n        if key in self._outputformat.keys():\n            return self.format(key)\n        raise AttributeError\n\n    def load(self):\n        \"\"\"\n        Load the CITATION.cff file\n        \"\"\"\n        self._citation = create_citation(self._infile, url=None)\n        try:\n            self._citation.validate()\n        except Exception as e:\n            raise ImportError(e)\n\n    def save(self):\n        \"\"\"\n        Write the CITATION.cff file\n        \"\"\"\n        with self._infile.open(\"w\") as fid:\n            fid.write(yaml.dump(self._citation.cffobj, indent=2))\n\n    def __str__(self):\n        return self.apa\n\n    def format(self, fmt=\"apa\"):\n        \"\"\"\n        Return a str with citation in the given format\n\n        Parameters\n        ----------\n        fmt : str, optional, default: \"apa\"\n            Output format: \"apa', \"bibtex\", \"cff\", \"endnote\" or \"ris\"\n\n        Return\n        ------\n        str\n            The citation in the given format\n\n        Examples\n        --------\n\n        >>> citation = Citation()\n        >>> apa = citation.format(\"apa\")\n\n        It is also possible to directly get the desired format using the name of the\n        attribute:\n        e.g.,\n\n        >>> apa = citation.apa\n\n        By default, printing, citation result is done with the apa format:\n\n        >>> print(citation)\n        Travert A., Fernandez C. ...\n        \"\"\"\n        return self._outputformat[fmt]()\n\n    def update_date(self):\n        \"\"\"\n        Update the released-date metadata .\n        \"\"\"\n        self._citation.cffobj[\"date-released\"] = date.today().isoformat()\n\n    def update_version(self, version=None):\n        \"\"\"\n        Update the version metadata.\n        \"\"\"\n        if version is None:\n            version = gitversion\n        self._citation.cffobj[\"version\"] = \".\".join(version.split(\".\")[:3])\n\n\ndef make_citation(version):\n    \"\"\"\"\"\"\n    citation = Citation()\n    citation.load()\n    citation.update_version(version)\n    citation.update_date()\n    print(citation)\n    citation.save()\n\n\ndef make_zenodo(version):\n    \"\"\"\"\"\"\n    zenodo = Zenodo()\n    zenodo.load()\n    zenodo.update_version(version)\n    zenodo.update_date()\n    print(zenodo)\n    zenodo.save()\n\n\ndef make_release_note_index(revision):\n\n    # remove old rev files\n    files = WN.glob(\"v*.dev*.rst\")\n    for file in files:\n        file.unlink()\n    if (WN / \"latest.rst\").exists():\n        (WN / \"latest.rst\").unlink()\n\n    # Create or update file with the current version number\n    if revision == \"unreleased\":\n        revision = gitversion.split(\"+\")[0]\n\n    content = (WN / \"changelog.rst\").read_text()\n\n    sections = re.split(r\"^\\.\\. section$\", content, flags=re.M)\n\n    # remove void sections and clean other sections\n    header = re.sub(r\"(\\.\\.\\n(.*\\n)*)\", \"\", sections[0], 0)\n    header = header.strip() + \"\\n\"\n    cleaned_sections = [\n        header,\n    ]\n    for section in sections[1:]:\n        if section.strip().endswith(\"(do not delete this comment)\"):\n            continue\n        content = re.sub(\n            r\"(\\.\\. Add.*\\(do not delete this comment\\)\\n)\", \"\", section, 0\n        )\n        content = content.strip() + \"\\n\"\n        cleaned_sections.append(content)\n\n    changelog_content = \"\\n\".join(cleaned_sections)\n    # changelog_content = changelog_content.strip() + \"\\n\"  # end of file\n    changelog_content = changelog_content.replace(\"{{ revision }}\", revision)\n\n    if \".dev\" in revision:\n        (WN / \"latest.rst\").write_text(changelog_content)\n    else:\n        # in principle this happens for release, create the related rst file\n        (WN / f\"v{revision}.rst\").write_text(changelog_content)\n        # void changelog (keep only section titles)\n        (WN / \"changelog.rst\").write_text(\n            \"\"\"\nWhat's new in revision {{ revision }}\n---------------------------------------------------------------------------------------\n\nThese are the changes in SpectroChemPy-{{ revision }}.\nSee :ref:`release` for a full changelog including other versions of SpectroChemPy.\n\n..\n   Do not remove the ``revision`` marker. It will be replaced during doc building.\n   Also do not delete the section titles.\n   Add your list of changes between (Add here) and (section) comments\n   keeping a blank line before and after this list.\n\n\n.. section\n\nNew features\n~~~~~~~~~~~~\n.. Add here new public features (do not delete this comment)\n\n\n.. section\n\nBug fixes\n~~~~~~~~~\n.. Add here new bug fixes (do not delete this comment)\n\n\n.. section\n\nBreaking changes\n~~~~~~~~~~~~~~~~\n.. Add here new breaking changes (do not delete this comment)\n\n\n.. section\n\nDeprecations\n~~~~~~~~~~~~\n.. Add here new deprecations (do not delete this comment)\n\"\"\"\n        )\n    # Create the new index.rst file\n    files = WN.glob(\"v*.rst\")\n    names = []\n    for file in files:\n        name = file.name\n        names.append(name)\n    names.sort()\n    names.reverse()\n    dicvers = {}\n    for name in names:\n        arr = name.split(\".\")\n        base = \".\".join(arr[:3])\n        v = f\"{arr[0][1]}.{arr[1]}\"\n        if v in dicvers:\n            dicvers[v].append(base)\n        else:\n            dicvers[v] = [base]\n\n    with open(WN / \"index.rst\", \"w\") as f:\n        f.write(\n            \"\"\".. _release:\n\n..\n   Do not modify this file as it is automatically generated.\n   See '.ci/update_version_and_release_notes.py' if you need to change the output.\n\n*************\nRelease notes\n*************\n\nThis is the list of changes to `SpectroChemPy` between each release. For full details,\nsee the `commit logs <https://github.com/spectrochempy/spectrochempy/commits/>`_ .\nFor install and upgrade instructions, see :ref:`installation`\\ .\n\"\"\"\n        )\n        for i, vers in enumerate(dicvers):\n            latest = \"\\n    latest\" if i == 0 and \".dev\" in revision else \"\"\n            f.write(\n                f\"\"\"\nVersion {vers}\n--------------\n\n.. toctree::\n    :maxdepth: 2\n{latest}\n\"\"\"\n            )\n            li = sorted(dicvers[vers], key=lambda x: int(str.split(x, \".\")[2]))\n            li.reverse()\n            for rev in li:\n                f.write(f\"    {rev}\\n\")\n\n\nif __name__ == \"__main__\":\n\n    if len(sys.argv) > 1:\n        new_revision = sys.argv[1]\n    else:\n        new_revision = \"unreleased\"\n\n    if new_revision != \"unreleased\":\n        make_citation(new_revision)\n        make_zenodo(new_revision)\n\n    make_release_note_index(new_revision)\n", "path": ".ci/update_version_and_release_notes.py"}], "after_files": [{"content": "import json\nimport re\nimport sys\nfrom datetime import date\nfrom pathlib import Path\n\nimport yaml\nfrom cffconvert.cli.create_citation import create_citation\nfrom setuptools_scm import get_version\n\nCI = Path(__file__).parent\nPROJECT = CI.parent\nCITATION = PROJECT / \"CITATION.cff\"\nZENODO = PROJECT / \".zenodo.json\"\nDOCS = PROJECT / \"docs\"\nWN = DOCS / \"whatsnew\"\n\ngitversion = get_version(root=\"..\", relative_to=__file__)\n\n\nclass Zenodo:\n    def __init__(self, infile=ZENODO):\n        self._infile = infile\n        self._js = None\n\n    def load(self):\n        \"\"\"\n        Load the .zenodo.json file\n        \"\"\"\n        with self._infile.open(\"r\") as fid:\n            self._js = json.load(fid)\n\n    def save(self):\n        \"\"\"\n        Write the .zenodo.json file\n        \"\"\"\n        with self._infile.open(\"w\") as fid:\n            json.dump(self._js, fid, indent=2)\n            fid.write(\"\\n\")  # add a trailing blank line for pre-commit compat.\n\n    def update_date(self):\n        \"\"\"\n        Update the publication date metadata\n        \"\"\"\n        self._js[\"publication_date\"] = date.today().isoformat()\n\n    def update_version(self, version=None):\n        \"\"\"\n        Update the version string metadata\n        \"\"\"\n        if version is None:\n            version = gitversion\n        self._js[\"version\"] = \".\".join(version.split(\".\")[:3])\n\n    def __str__(self):\n        return json.dumps(self._js, indent=2)\n\n\nclass Citation:\n    def __init__(self, infile=CITATION):\n        self._infile = infile\n        self._citation = None\n\n    def __getattr__(self, key):\n        if not self._citation:\n            self.load()\n        self._outputformat = {\n            \"apa\": self._citation.as_apalike,\n            \"bibtex\": self._citation.as_bibtex,\n            \"cff\": self._citation.as_cff,\n            \"endnote\": self._citation.as_endnote,\n            \"ris\": self._citation.as_ris,\n        }\n        if key in self._outputformat.keys():\n            return self.format(key)\n        raise AttributeError\n\n    def load(self):\n        \"\"\"\n        Load the CITATION.cff file\n        \"\"\"\n        self._citation = create_citation(self._infile, url=None)\n        try:\n            self._citation.validate()\n        except Exception as e:\n            raise ImportError(e)\n\n    def save(self):\n        \"\"\"\n        Write the CITATION.cff file\n        \"\"\"\n        with self._infile.open(\"w\") as fid:\n            fid.write(yaml.dump(self._citation.cffobj, indent=2))\n\n    def __str__(self):\n        return self.apa\n\n    def format(self, fmt=\"apa\"):\n        \"\"\"\n        Return a str with citation in the given format\n\n        Parameters\n        ----------\n        fmt : str, optional, default: \"apa\"\n            Output format: \"apa', \"bibtex\", \"cff\", \"endnote\" or \"ris\"\n\n        Return\n        ------\n        str\n            The citation in the given format\n\n        Examples\n        --------\n\n        >>> citation = Citation()\n        >>> apa = citation.format(\"apa\")\n\n        It is also possible to directly get the desired format using the name of the\n        attribute:\n        e.g.,\n\n        >>> apa = citation.apa\n\n        By default, printing, citation result is done with the apa format:\n\n        >>> print(citation)\n        Travert A., Fernandez C. ...\n        \"\"\"\n        return self._outputformat[fmt]()\n\n    def update_date(self):\n        \"\"\"\n        Update the released-date metadata .\n        \"\"\"\n        self._citation.cffobj[\"date-released\"] = date.today().isoformat()\n\n    def update_version(self, version=None):\n        \"\"\"\n        Update the version metadata.\n        \"\"\"\n        if version is None:\n            version = gitversion\n        self._citation.cffobj[\"version\"] = \".\".join(version.split(\".\")[:3])\n\n\ndef make_citation(version):\n    \"\"\"\"\"\"\n    citation = Citation()\n    citation.load()\n    citation.update_version(version)\n    citation.update_date()\n    print(citation)\n    citation.save()\n\n\ndef make_zenodo(version):\n    \"\"\"\"\"\"\n    zenodo = Zenodo()\n    zenodo.load()\n    zenodo.update_version(version)\n    zenodo.update_date()\n    print(zenodo)\n    zenodo.save()\n\n\ndef make_release_note_index(revision):\n\n    # remove old last revision files\n    files = WN.glob(\"v*.dev*.rst\")\n    for file in files:\n        file.unlink()\n    if (WN / \"latest.rst\").exists():\n        (WN / \"latest.rst\").unlink()\n\n    # Create or update file with the current version number\n    if revision == \"unreleased\":\n        revision = gitversion.split(\"+\")[0]\n\n    content = (WN / \"changelog.rst\").read_text()\n\n    sections = re.split(r\"^\\.\\. section$\", content, flags=re.M)\n\n    # remove void sections and clean other sections\n    header = re.sub(r\"(\\.\\.\\n(.*\\n)*)\", \"\", sections[0], 0)\n    header = header.strip() + \"\\n\"\n    cleaned_sections = [\n        header,\n    ]\n    for section in sections[1:]:\n        if section.strip().endswith(\"(do not delete this comment)\"):\n            continue\n        content = re.sub(\n            r\"(\\.\\. Add.*\\(do not delete this comment\\)\\n)\", \"\", section, 0\n        )\n        content = content.strip() + \"\\n\"\n        cleaned_sections.append(content)\n\n    changelog_content = \"\\n\".join(cleaned_sections)\n    # changelog_content = changelog_content.strip() + \"\\n\"  # end of file\n    changelog_content = changelog_content.replace(\"{{ revision }}\", revision)\n\n    if \".dev\" in revision:\n        (WN / \"latest.rst\").write_text(changelog_content)\n    else:\n        # in principle this happens for release, create the related rst file\n        (WN / f\"v{revision}.rst\").write_text(changelog_content)\n        # void changelog (keep only section titles)\n        (WN / \"changelog.rst\").write_text(\n            \"\"\"\n:orphan:\n\nWhat's new in revision {{ revision }}\n---------------------------------------------------------------------------------------\n\nThese are the changes in SpectroChemPy-{{ revision }}.\nSee :ref:`release` for a full changelog including other versions of SpectroChemPy.\n\n..\n   Do not remove the ``revision`` marker. It will be replaced during doc building.\n   Also do not delete the section titles.\n   Add your list of changes between (Add here) and (section) comments\n   keeping a blank line before and after this list.\n\n\n.. section\n\nNew features\n~~~~~~~~~~~~\n.. Add here new public features (do not delete this comment)\n\n\n.. section\n\nBug fixes\n~~~~~~~~~\n.. Add here new bug fixes (do not delete this comment)\n\n\n.. section\n\nBreaking changes\n~~~~~~~~~~~~~~~~\n.. Add here new breaking changes (do not delete this comment)\n\n\n.. section\n\nDeprecations\n~~~~~~~~~~~~\n.. Add here new deprecations (do not delete this comment)\n\"\"\"\n        )\n    # Create the new index.rst file\n    files = WN.glob(\"v*.rst\")\n    names = []\n    for file in files:\n        name = file.name\n        names.append(name)\n    names.sort()\n    names.reverse()\n    dicvers = {}\n    for name in names:\n        arr = name.split(\".\")\n        base = \".\".join(arr[:3])\n        v = f\"{arr[0][1]}.{arr[1]}\"\n        if v in dicvers:\n            dicvers[v].append(base)\n        else:\n            dicvers[v] = [base]\n\n    with open(WN / \"index.rst\", \"w\") as f:\n        f.write(\n            \"\"\".. _release:\n\n..\n   Do not modify this file as it is automatically generated.\n   See '.ci/update_version_and_release_notes.py' if you need to change the output.\n\n*************\nRelease notes\n*************\n\nThis is the list of changes to `SpectroChemPy` between each release. For full details,\nsee the `commit logs <https://github.com/spectrochempy/spectrochempy/commits/>`_ .\nFor install and upgrade instructions, see :ref:`installation`\\ .\n\"\"\"\n        )\n        for i, vers in enumerate(dicvers):\n            latest = \"\\n    latest\" if i == 0 and \".dev\" in revision else \"\"\n            f.write(\n                f\"\"\"\nVersion {vers}\n--------------\n\n.. toctree::\n    :maxdepth: 2\n{latest}\n\"\"\"\n            )\n            li = sorted(dicvers[vers], key=lambda x: int(str.split(x, \".\")[2]))\n            li.reverse()\n            for rev in li:\n                f.write(f\"    {rev}\\n\")\n\n\nif __name__ == \"__main__\":\n\n    if len(sys.argv) > 1:\n        new_revision = sys.argv[1]\n    else:\n        new_revision = \"unreleased\"\n\n    if new_revision != \"unreleased\":\n        make_citation(new_revision)\n        make_zenodo(new_revision)\n\n    make_release_note_index(new_revision)\n", "path": ".ci/update_version_and_release_notes.py"}]}