Skip to content

Commit

Permalink
[Fix](CI) Support remove spare suffix of links in documents (#1551)
Browse files Browse the repository at this point in the history
## Versions 

- [ ] dev
- [ ] 3.0
- [ ] 2.1
- [ ] 2.0

## Languages

- [ ] Chinese
- [ ] English

## Docs Checklist

- [ ] Checked by AI
- [ ] Test Cases Built
  • Loading branch information
zclllyybb authored Dec 20, 2024
1 parent 1f2ebd8 commit 8e35862
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions check_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ def process_md_file(file_path):
full_path += ".md"

for [from_path, to_path] in move_pairs:
# Skip change of suffix
from_base, from_ext = os.path.splitext(from_path)
to_base, to_ext = os.path.splitext(to_path)
if (from_ext in [".md", ".mdx"] and to_ext in [".md", ".mdx"]) and (
from_base == to_base
):
if (
from_ext in [".md", ".mdx", ""] or to_ext in [".md", ".mdx", ""]
) and (from_base == to_base):
continue
# In md, the link relative path starts from the directory where the document is located, not the document
relative_to_path = os.path.relpath(
Expand Down

0 comments on commit 8e35862

Please sign in to comment.