# wads.docs_ignore

Remove the legacy `docs/*` line from a repo’s `.gitignore` (i2mint/wads#249).

Old wads templates ignored the whole `docs/` directory, which silently drops
hand-written docs. [`fix_docs_ignore()`](#wads.docs_ignore.fix_docs_ignore) deletes those lines, keeps build output
ignored with `docs/_build/`, and first checks that no file under `docs/` that is
ignored today would show up as untracked afterwards.

```pycon
>>> new_gitignore("*.pyc\ndocs/*\n")
'*.pyc\ndocs/_build/\n'
>>> new_gitignore("docs/*\ndocs/_build/\n")
'docs/_build/\n'
>>> new_gitignore("*.pyc\n") is None
True
```

### Module Attributes

| [`KEEP_IGNORED`](#wads.docs_ignore.KEEP_IGNORED)   | build output stays ignored.   |
|-----------------------------------------------------------------|-------------------------------|

### Functions

| [`exposed_files`](#wads.docs_ignore.exposed_files)(repo)                   | Files under `docs/` that are ignored now and would not stay ignored by `docs/_build/`.   |
|----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| [`fix_docs_ignore`](#wads.docs_ignore.fix_docs_ignore)([repo, apply, force]) | Plan (and with `apply=True` write) the removal of the legacy `docs/*` line.              |
| [`new_gitignore`](#wads.docs_ignore.new_gitignore)(text)                   | `.gitignore` text without the legacy docs lines, or `None` if there are none.            |

### wads.docs_ignore.KEEP_IGNORED *= 'docs/_build/'*

build output stays ignored.

* **Type:**
  What replaces the legacy line

### wads.docs_ignore.exposed_files(repo)

Files under `docs/` that are ignored now and would not stay ignored by `docs/_build/`.

* **Return type:**
  [`list`](https://docs.python.org/3/builtins/stdtypes.html#list)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]

### wads.docs_ignore.fix_docs_ignore(repo='.', , apply=False, force=False)

Plan (and with `apply=True` write) the removal of the legacy `docs/*` line.

Returns `{"status": ..., "exposed": [...]}` where status is `"clean"` (nothing to
do), `"blocked"` (files under `docs/` would be exposed; pass `force=True` to
proceed), `"planned"` or `"fixed"`.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### wads.docs_ignore.new_gitignore(text)

`.gitignore` text without the legacy docs lines, or `None` if there are none.

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str) | [`None`](https://docs.python.org/3/builtins/constants.html#None)
