Skip to content

Commit 045cd4c

Browse files
committed
📝 Add documents for alternatives
sphinxcontrib-requirements-txt sphinxcontrib-autofile
1 parent 6a7ee60 commit 045cd4c

File tree

4 files changed

+35
-14
lines changed

4 files changed

+35
-14
lines changed

.pre-commit-config.yaml

100755100644
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env -S pre-commit run -ac
21
---
32
repos:
43
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -23,11 +22,11 @@ repos:
2322
- id: check-toml
2423
- id: check-json
2524
- repo: https://github.com/Lucas-C/pre-commit-hooks
26-
rev: v1.4.2
25+
rev: v1.5.4
2726
hooks:
2827
- id: remove-crlf
2928
- repo: https://github.com/codespell-project/codespell
30-
rev: v2.2.4
29+
rev: v2.2.5
3130
hooks:
3231
- id: codespell
3332
additional_dependencies:
@@ -39,24 +38,27 @@ repos:
3938
args:
4039
- --msg-filename
4140
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
42-
rev: 2.7.1
41+
rev: 2.7.2
4342
hooks:
4443
- id: editorconfig-checker
4544
- repo: https://github.com/jumanjihouse/pre-commit-hooks
4645
rev: 3.0.0
4746
hooks:
4847
- id: check-mailmap
48+
- repo: https://github.com/rhysd/actionlint
49+
rev: v1.6.25
50+
hooks:
51+
- id: actionlint
4952
- repo: https://github.com/adrienverge/yamllint
50-
rev: v1.30.0
53+
rev: v1.32.0
5154
hooks:
5255
- id: yamllint
5356
- repo: https://github.com/executablebooks/mdformat
5457
rev: 0.7.16
5558
hooks:
5659
- id: mdformat
57-
args:
58-
- --number
5960
additional_dependencies:
61+
- mdformat-pyproject
6062
- mdformat-gfm
6163
- mdformat-myst
6264
- mdformat-toc
@@ -65,22 +67,22 @@ repos:
6567
- mdformat-black
6668
- mdformat-config
6769
- repo: https://github.com/DavidAnson/markdownlint-cli2
68-
rev: v0.6.0
70+
rev: v0.8.1
6971
hooks:
7072
- id: markdownlint-cli2
7173
additional_dependencies:
7274
7375
- repo: https://github.com/Freed-Wu/pre-commit-hooks
74-
rev: 0.0.10
76+
rev: 0.0.11
7577
hooks:
7678
- id: update-CITATION.cff
7779
- id: update-pyproject.toml
7880
- repo: https://github.com/perltidy/perltidy
79-
rev: "20230309.02"
81+
rev: "20230701.02"
8082
hooks:
8183
- id: perltidy
8284
- repo: https://github.com/psf/black
83-
rev: 23.1.0
85+
rev: 23.7.0
8486
hooks:
8587
- id: black
8688
- repo: https://github.com/PyCQA/isort
@@ -94,7 +96,7 @@ repos:
9496
additional_dependencies:
9597
- tomli
9698
- repo: https://github.com/kumaraditya303/mirrors-pyright
97-
rev: v1.1.300
99+
rev: v1.1.322
98100
hooks:
99101
- id: pyright
100102
- repo: https://github.com/PyCQA/bandit

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ examples.
114114

115115
#### [Generate API Document](https://github.com/Freed-Wu/translate-shell/tree/main/docs/api/translate_shell.md)
116116

117+
**Note**: A more "sphinx" solution is
118+
[sphinxcontrib-autofile](https://github.com/sphinx-contrib/autofile).
119+
117120
Before:
118121

119122
````markdown
@@ -142,7 +145,7 @@ scripts/generate-api.md.pl src/*/*.py
142145
`````
143146

144147
Where
145-
[`scripts/generate-api.md.pl`](https://github.com/Freed-Wu/translate-shell/blob/main/scripts/generate-api.md.pl)
148+
[`scripts/generate-api.md.pl`](https://github.com/sphinx-contrib/eval/blob/main/scripts/generate-api.md.pl)
146149
replaces all `src/translate_shell/XXX.py`s to
147150

148151
```rst
@@ -184,6 +187,9 @@ searches all `TODO`s in code then convert them to correct hyperlinks.
184187

185188
#### [Generate Requirements Document](https://github.com/Freed-Wu/translate-shell/tree/main/docs/resources/requirements.md)
186189

190+
**Note**: A more "sphinx" solution is
191+
[sphinxcontrib-requirements-txt](https://github.com/sphinx-contrib/requirements-txt).
192+
187193
Before:
188194

189195
```markdown
@@ -210,7 +216,7 @@ generate-requirements.md.pl
210216
````
211217

212218
Where
213-
[`scripts/generate-requirements.md.pl`](https://github.com/Freed-Wu/translate-shell/blob/main/scripts/generate-requirements.md.pl)
219+
[`scripts/generate-requirements.md.pl`](https://github.com/sphinx-contrib/eval/blob/main/scripts/generate-requirements.md.pl)
214220
searches all `requirements/*.txt`s and `requirements/completion.txt` is:
215221

216222
```unixconfig

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ file = "requirements/dev.txt"
5151
file = "requirements/myst.txt"
5252
# end: scripts/update-pyproject.toml.pl
5353

54+
[tool.mdformat]
55+
number = true
56+
5457
[tool.black]
5558
line-length = 79
5659

scripts/generate-requirements.md.pl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env -S perl -p
2+
$title = $ARGV;
3+
$title =~ s=.*?requirements/(.*?)\.txt=$1=;
4+
if (m(^[^#].*://)) {
5+
s=(^.*://)(.*)=- [$1$2](https://$2)=;
6+
next;
7+
}
8+
s`^([^#\n][^\s[>=<^!^]*)`- [$1](https://pypi.org/project/$1)`;
9+
s/^#\s*//;
10+
s/^!.*/## $title/;

0 commit comments

Comments
 (0)