@@ -65,15 +65,15 @@ For myst:
6565
6666```` markdown
6767```{eval-sh}
68- echo My OS is $OSTYPE
68+ echo My OS is $OSTYPE.
6969```
7070````
7171
7272For rst:
7373
7474``` rst
7575.. eval-sh::
76- echo My OS is $OSTYPE
76+ echo My OS is $OSTYPE.
7777
7878```
7979
@@ -86,12 +86,13 @@ sphinx-build docs docs/_build/html
8686Result:
8787
8888``` text
89- My OS is linux-gnu
89+ My OS is linux-gnu.
9090```
9191
9292### Advanced Usages
9393
94- All the following code is myst. The corresponding rst is similar.
94+ All of the following examples are myst. The corresponding examples of rst are
95+ similar. Remember to add ` scripts ` to your ` $PATH ` in ` docs/conf.py ` .
9596Click the hyperlink of title to see the actual example.
9697
9798#### [ Generate API Document] ( https://github.com/Freed-Wu/translate-shell/tree/main/docs/api/translate_shell.md )
@@ -117,23 +118,24 @@ Now
117118
118119````{eval-rst}
119120```{eval-sh}
120- scripts/ generate-api.md.sh '' -maxdepth 1
121+ generate-api.md.sh '' -maxdepth 1
121122```
122123````
123124`````
124125
125126Where ` scripts/generate-api.md.sh ` is a script which search all python file and
126- replace them from ` src/translate_shell/X/Y/Z .py ` to
127+ replace them from ` src/translate_shell/XXX .py ` to
127128
128129``` rst
129- .. automodule:: translate_shell.X.Y.Z`
130+ .. automodule:: translate_shell.XXX
130131 :members:
131132```
132133
133134``` bash
134135#! /usr/bin/env bash
135136# shellcheck disable=SC2086
136- find src/sphinxcontrib/eval/$1 $2 $3 -name ' *.py' |
137+ cd " $( dirname " $( dirname " $0 " ) " ) " || exit 1
138+ find src/translate_shell/$1 $2 $3 -name ' *.py' |
137139perl -pe' s=src/=.. automodule:: =g;
138140s=\.py$=\n :members:=g;s=/__init__==g;s=/=.=g'
139141```
@@ -142,38 +144,40 @@ s=\.py$=\n :members:=g;s=/__init__==g;s=/=.=g'
142144
143145Before:
144146
145- <!-- markdownlint-disable MD013-->
146-
147147``` markdown
148148# TODO
149149
150- - <https://github.com/Freed-Wu/tranlate-shell/tree/main/src/translate_shell/translators/stardict/__init__.py#L4> more stardicts.
151- - <https://github.com/Freed-Wu/tranlate-shell/tree/main/src/translate_shell/translators/stardict/__init__.py#L5> Create different subclasses for different dict to get phonetic, explains
152- - <https://github.com/Freed-Wu/tranlate-shell/tree/main/src/translate_shell/ui/repl.py#L33> make the last line gray like ptpython
153- ...
150+ - <https://github.com/Freed-Wu/tranlate-shell/tree/main/src/translate_shell/translators/stardict/__init__.py#L4>
151+ more stardicts.
152+ - <https://github.com/Freed-Wu/tranlate-shell/tree/main/src/translate_shell/translators/stardict/__init__.py#L5>
153+ Create different subclasses for different dict to get phonetic, explains
154+ - <https://github.com/Freed-Wu/tranlate-shell/tree/main/src/translate_shell/ui/repl.py#L33>
155+ make the last line gray like ptpython
156+ - ...
154157```
155158
156- <!-- markdownlint-enable MD013-->
157-
158159Now:
159160
160161```` markdown
161162# TODO
162163
163164```{eval-sh}
164- scripts/ generate-todo.md.sh
165+ generate-todo.md.sh
165166```
166167````
167168
168- Where the script searches all ` TODO ` s in code then convert them to correct hyperlinks.
169+ Where ` scripts/generate-todo.md.sh ` searches all ` TODO ` s in code then convert
170+ them to correct hyperlinks.
169171
170172``` sh
171- grep -RIn TODO: src | perl -pe' s/:/#L/;s/:\s*#?\s*TODO:\s*/ /;
173+ #! /usr/bin/env bash
174+ cd " $( dirname " $( dirname " $0 " ) " ) " || exit 1
175+ grep -RIn TODO: src | perl -pe' s/:/#L/;s/:\s*#?\s*TODO:\s*/ /;
172176s=^=- https://github.com/Freed-Wu/tranlate-shell/tree/main/=g;
173- s=(https://\S+)=<\1>=g'
177+ s=(https://\S+)=<\1>=g;s=^(- \S+)=\1\n=g '
174178```
175179
176- #### [ Generate Requirement Document] ( https://github.com/Freed-Wu/translate-shell/tree/main/docs/resources/requirements.md )
180+ #### [ Generate Requirements Document] ( https://github.com/Freed-Wu/translate-shell/tree/main/docs/resources/requirements.md )
177181
178182Before:
179183
@@ -195,22 +199,23 @@ Now
195199# Requirements
196200
197201```{eval-sh}
198- scripts/ generate-requirements.md.sh
202+ generate-requirements.md.sh
199203```
200204````
201205
202- Where
206+ Where ` scripts/generate-requirements.md.sh ` searches all ` requirements/*.txt ` s:
203207
204208``` bash
205209#! /usr/bin/env bash
206- for file in requirements.txt requirements/* .txt ; do
210+ cd " $( dirname " $( dirname " $0 " ) " ) " || exit 1
211+ for file in requirements/* .txt ; do
207212 filename=" ${file##*/ } "
208213 perl -pe' s=^([^#\n]\S*)=- [\1](https://pypi.org/project/\1)=g;
209214 s/^#\s*//g;s/^!.*/## ' " ${filename%% .txt} " ' /g' < " $file "
210215done
211216```
212217
213- And ` requirements/completion.txt ` :
218+ And ` requirements/completion.txt ` is :
214219
215220``` unixconfig
216221#!/usr/bin/env -S pip install -r
0 commit comments