Skip to content

Commit a0bf3d8

Browse files
Gao Weiespressif-bot
authored andcommitted
docs: Enable page redirection for old links
1 parent 14c79a0 commit a0bf3d8

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ examples/**/managed_components
2828
examples/**/dependencies.lock
2929

3030
# Doc build artifacts
31+
docs/_build/
3132
docs/*/_build/
3233
docs/*/doxygen-warning-log.txt
3334
docs/*/sphinx-warning-log.txt

docs/ADF_TEMPLATE_EXAMPLE_README_EN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
_Note that this is a template for an ESP-ADF example README.md file. When using this template, replace all these emphasised placeholders with example-specific content._
1+
_Note that this is a template for an ESP-ADF example README.md file. When using this template, replace all the emphasized placeholders (in italics) with example-specific content._
22

33
# _Example Title_
44

@@ -124,7 +124,7 @@ _Command to build the example_
124124
_Command to flash the example_
125125

126126
- Legacy GNU Make command: `make flash monitor`
127-
- CMake command: `idf.py -p PORT flash monitor`
127+
- CMake command: `idf.py build flash monitor`
128128

129129
For full steps to configure and build an ESP-IDF project, please go to [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html) and select the chip and version in the upper left corner of the page.
130130

docs/README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,24 @@ Use actual documentation generated within about 20 minutes on each commit:
1111
* English: https://docs.espressif.com/projects/esp-adf/en/latest/
1212
* 中文: https://docs.espressif.com/projects/esp-adf/zh_CN/latest/
1313

14-
The above URLs are all for the master branch latest version. Click the drop-down in the bottom left to choose a stable version or to download a PDF.
14+
The above URLs are all for the master branch latest version. Click on the link in the bottom right corner to download the PDF version.
1515

1616

1717
# Building Documentation
1818

19-
* Install `make` and `doxygen` for your platform (`make` may already be installed as an ESP-IDF prerequisite).
20-
* Change to either the docs/en or docs/zh_CN subdirectory and run `make html`
21-
* `make` will probably prompt you to run a python pip install step to get some other Python-related prerequisites. Run the command as shown, then re-run `make html` to build the docs.
19+
The documentation is built using the python package `esp-docs`, which can be installed by running:
20+
21+
```
22+
pip install esp-docs
23+
```
24+
25+
For a summary of available options, run:
26+
27+
```
28+
build-docs --help
29+
```
30+
31+
For more information, see [ESP-Docs User Guide](https://docs.espressif.com/projects/esp-docs/en/latest/).
2232

2333
## For MSYS2 MINGW32 on Windows
2434

docs/conf_common.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import re
12
import sys, os
23
from esp_docs.conf_docs import * # noqa: F403,F401
34
from local_util import run_cmd_get_output, copy_if_modified
@@ -28,6 +29,14 @@
2829
'esp_docs.esp_extensions.run_doxygen',
2930
]
3031

32+
# Custom added feature to allow redirecting old URLs
33+
with open('../page_redirects.txt') as f:
34+
lines = [re.sub(' +', ' ', line.strip()) for line in f.readlines() if line.strip() != '' and not line.startswith('#')]
35+
for line in lines: # check for well-formed entries
36+
if len(line.split(' ')) != 2:
37+
raise RuntimeError('Invalid line in page_redirects.txt: %s' % line)
38+
html_redirect_pages = [tuple(line.split(' ')) for line in lines]
39+
3140
# Disable format_esp_target
3241
extensions.remove('esp_docs.esp_extensions.format_esp_target')
3342

0 commit comments

Comments
 (0)