Skip to content

Commit

Permalink
Doc extensions: use StringList instead of ViewList (#2141)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeSullivan7 authored Mar 25, 2024
2 parents ef070b6 + b5977f6 commit 6a23dea
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 22 deletions.
4 changes: 2 additions & 2 deletions docs/ext/operations_user_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from docutils import nodes
from docutils.nodes import Node
from docutils.statemachine import ViewList
from docutils.statemachine import StringList
from docutils.parsers.rst import Directive
from sphinx.util.nodes import nested_parse_with_titles
"""Custom extension to add nicely formatted documentation for the operations.
Expand Down Expand Up @@ -81,7 +81,7 @@ def run(self) -> list[Node]:
rst_lines.append(f":class:`{op.filter_name} API docs<mantidimaging.core.operations.{op.__module__}>`")
rst_lines.append("")

rst = ViewList()
rst = StringList()
for n, rst_line in enumerate(rst_lines):
rst.append(rst_line, "generated.rst", n)

Expand Down
6 changes: 3 additions & 3 deletions docs/ext/release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from collections.abc import Iterable

from docutils import nodes
from docutils.statemachine import ViewList
from docutils.statemachine import StringList
from docutils.parsers.rst import Directive
from sphinx.errors import SphinxError
from sphinx.util.nodes import nested_parse_with_titles
Expand All @@ -24,10 +24,10 @@ class ReleaseNotes(Directive):
has_content = True

@classmethod
def make_rst(cls, note_type: str) -> ViewList:
def make_rst(cls, note_type: str) -> StringList:
note_paths: Iterable[Path] = (Path() / 'docs' / 'release_notes' / 'next').glob(note_type + '*')

rst = ViewList()
rst = StringList()
try:
note_paths = sorted(note_paths, key=lambda p: int(p.name.split('-')[1]))
except ValueError as exc:
Expand Down
3 changes: 3 additions & 0 deletions docs/release_notes/2.7.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Mantid Imaging 2.7
==================

New Features
------------
- #1912 : Support sub-directories in Live viewer
Expand Down
1 change: 1 addition & 0 deletions docs/release_notes/next/dev-2139-use-stringlist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#2139 : Doc extensions: use StringList instead of ViewList
16 changes: 0 additions & 16 deletions docs/release_notes/next/next.rst

This file was deleted.

2 changes: 1 addition & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
- mypy==1.8
- types-requests
- types-PyYAML
- types-docutils==0.20.0.20240311 # https://github.com/mantidproject/mantidimaging/issues/2139
- types-docutils
- pytest==7.4.*
- pytest-cov==4.1.*
- pytest-randomly==3.15.*
Expand Down

0 comments on commit 6a23dea

Please sign in to comment.