Skip to content

Commit 3bb41e6

Browse files
authored
Minor docstring fixes. (#67)
1 parent 237ede0 commit 3bb41e6

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

sphinx_external_toc/tools.py

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,15 @@ def create_site_from_toc(
3030
"""Create the files defined in the external toc file.
3131
3232
Additional files can also be created by defining them in
33-
`meta`/`create_files` of the toc.
34-
Text can also be appended to files, by defining them in `meta`/`create_append`
35-
(ass a mapping of files -> text)
33+
`meta`/`create_files` of the toc. Text can also be appended to files, by
34+
defining them in `meta`/`create_append` (as a mapping from files to text).
3635
37-
:param toc_path: Path to ToC.
38-
:param root_path: The root directory , or use ToC file directory.
39-
:param default_ext: The default file extension to use.
40-
:param encoding: Encoding for writing files
41-
:param overwrite: Overwrite existing files (otherwise raise ``IOError``).
42-
:param toc_name: Copy toc file to root with this name
36+
:param toc_path: path to ToC file
37+
:param root_path: the root directory, or use ToC file directory
38+
:param default_ext: default file extension to use
39+
:param encoding: encoding for writing files
40+
:param overwrite: overwrite existing files (otherwise raise ``IOError``)
41+
:param toc_name: copy ToC file to root with this name
4342
4443
"""
4544
assert default_ext in {".rst", ".md"}
@@ -101,16 +100,16 @@ def create_site_map_from_path(
101100
) -> SiteMap:
102101
"""Create the site-map from a folder structure.
103102
104-
Files and folders are sorted in natural order,
105-
see: https://en.wikipedia.org/wiki/Natural_sort_order
106-
107-
:param suffixes: File suffixes to consider as documents
108-
:param default_index: File name (without suffix) considered as the index file
109-
for a folder, if not found then the first file is taken as the index
110-
:param ignore_matches: file/folder names which match one of these will be ignored,
111-
uses fnmatch Unix shell-style wildcards,
112-
defaults to ignoring hidden files (starting with a dot)
103+
Files and folders are sorted in natural order, see:
104+
https://en.wikipedia.org/wiki/Natural_sort_order.
113105
106+
:param suffixes: file suffixes to consider as documents
107+
:param default_index: file name (without suffix) considered as the index
108+
file for a folder, if not found then the first file is taken as the
109+
index
110+
:param ignore_matches: file/folder names which match one of these will be
111+
ignored, uses fnmatch Unix shell-style wildcards, defaults to ignoring
112+
hidden files (starting with a dot)
114113
"""
115114
root_path = Path(root_path)
116115
# assess root
@@ -141,7 +140,12 @@ def create_site_map_from_path(
141140

142141
# while there are subfolders add them to the site-map
143142
while indexed_folders:
144-
sub_path, child_index, child_files, child_folders = indexed_folders.pop(0)
143+
(
144+
sub_path,
145+
child_index,
146+
child_files,
147+
child_folders,
148+
) = indexed_folders.pop(0)
145149
for child_file in child_files:
146150
child_docname = (sub_path / child_file).relative_to(root_path).as_posix()
147151
assert child_docname not in site_map
@@ -221,9 +225,7 @@ def _assess_folder(
221225
default_index: str,
222226
ignore_matches: Sequence[str],
223227
) -> Tuple[Optional[str], Sequence[str], Sequence[str]]:
224-
"""Assess the folder for ToC items.
225-
226-
strips suffixes from file names,
228+
"""Assess the folder for ToC items. Strips suffixes from file names and
227229
sorts file/folder names by natural order.
228230
229231
:returns: (index file name, other file names, folders)

0 commit comments

Comments
 (0)