Skip to content

Commit fa85bf3

Browse files
authored
♻️ REFACTOR: to/from-site to to/from-project (#34)
This PR renames the two CLI commands: - `to-site` and `from-site` to instead be: - `to-project` and `from-project` The rationale for this is to avoid using web-specific terminology (web**site**).
1 parent e651a89 commit fa85bf3

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -287,16 +287,16 @@ Options:
287287
-h, --help Show this message and exit.
288288
289289
Commands:
290-
from-site Create a ToC file from a site directory.
290+
from-project Create a ToC file from a project directory.
291291
migrate Migrate a ToC from a previous revision.
292292
parse Parse a ToC file to a site-map YAML.
293-
to-site Create a site directory from a ToC file.
293+
to-project Create a project directory from a ToC file.
294294
```
295295

296-
To build a template site from only a ToC file:
296+
To build a template project from only a ToC file:
297297

298298
```console
299-
$ sphinx-etoc to-site -p path/to/site -e rst path/to/_toc.yml
299+
$ sphinx-etoc to-project -p path/to/site -e rst path/to/_toc.yml
300300
```
301301

302302
Note, you can also add additional files in `meta`/`create_files` amd append text to the end of files with `meta`/`create_append`, e.g.
@@ -319,7 +319,7 @@ meta:
319319
To build a ToC file from an existing site:
320320

321321
```console
322-
$ sphinx-etoc from-site path/to/folder
322+
$ sphinx-etoc from-project path/to/folder
323323
```
324324

325325
Some rules used:
@@ -335,7 +335,7 @@ The command can also guess a `title` for each file, based on its path:
335335
- Words are split by `_`
336336
- The first "word" is removed if it is an integer
337337

338-
For example, for a site with files:
338+
For example, for a project with files:
339339

340340
```
341341
index.rst
@@ -356,7 +356,7 @@ index.rst
356356
will create the ToC:
357357

358358
```console
359-
$ sphinx-etoc from-site path/to/folder -i index -s ".*" -e ".rst" -t
359+
$ sphinx-etoc from-project path/to/folder -i index -s ".*" -e ".rst" -t
360360
root: index
361361
entries:
362362
- file: 1_a_title

sphinx_external_toc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""A sphinx extension that allows the site toctree to be defined in a single file."""
1+
"""A sphinx extension that allows the project toctree to be defined in a single file."""
22

33
__version__ = "0.1.0"
44

sphinx_external_toc/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def parse_toc(toc_file):
2626
click.echo(yaml.dump(site_map.as_json(), sort_keys=False, default_flow_style=False))
2727

2828

29-
@main.command("to-site")
29+
@main.command("to-project")
3030
@click.argument("toc_file", type=click.Path(exists=True, file_okay=True))
3131
@click.option(
3232
"-p",
@@ -45,15 +45,15 @@ def parse_toc(toc_file):
4545
)
4646
@click.option("-o", "--overwrite", is_flag=True, help="Overwrite existing files.")
4747
def create_site(toc_file, path, extension, overwrite):
48-
"""Create a site directory from a ToC file."""
48+
"""Create a project directory from a ToC file."""
4949
create_site_from_toc(
5050
toc_file, root_path=path, default_ext="." + extension, overwrite=overwrite
5151
)
5252
# TODO option to add basic conf.py?
5353
click.secho("SUCCESS!", fg="green")
5454

5555

56-
@main.command("from-site")
56+
@main.command("from-project")
5757
@click.argument(
5858
"site_dir", type=click.Path(exists=True, file_okay=False, dir_okay=True)
5959
)
@@ -95,7 +95,7 @@ def create_site(toc_file, path, extension, overwrite):
9595
help="The key-mappings to use.",
9696
)
9797
def create_toc(site_dir, extension, index, skip_match, guess_titles, file_format):
98-
"""Create a ToC file from a site directory."""
98+
"""Create a ToC file from a project directory."""
9999
site_map = create_site_map_from_path(
100100
site_dir,
101101
suffixes=extension,

tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_parse_toc(invoke_cli):
3535

3636

3737
def test_create_toc(tmp_path, invoke_cli, file_regression):
38-
# create site files
38+
# create project files
3939
files = [
4040
"index.rst",
4141
"1_a_title.rst",

tests/test_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_file_to_sitemap(path: Path, tmp_path: Path, data_regression):
2626

2727
def test_create_site_map_from_path(tmp_path: Path, data_regression):
2828

29-
# create site files
29+
# create project files
3030
files = [
3131
"index.rst",
3232
"1_other.rst",

0 commit comments

Comments
 (0)