forked from docs/doc-exports
Update conversion script
- drop line wrapping (leaves lines long, but at least doesn't corrup indentation) - repair cross links by replacing them to the relative path of the new name - further extend new name calculation - add input path argument
This commit is contained in:
parent
446860da26
commit
d96bbbe08f
@ -1 +0,0 @@
|
||||
../../process.py
|
File diff suppressed because it is too large
Load Diff
50
process.py
50
process.py
File diff suppressed because it is too large
Load Diff
25
process_links.py
Normal file
25
process_links.py
Normal file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import argparse
|
||||
import subprocess
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Process links.')
|
||||
parser.add_argument(
|
||||
'path', type=str, help='path to the files')
|
||||
args = parser.parse_args()
|
||||
matrix = json.loads(open("matrix.json").read())
|
||||
for k, v in matrix.items():
|
||||
replace = v.replace('/', '\/')
|
||||
subprocess.run(
|
||||
f"find {args.path} -name *'.rst' -type f -print0 | xargs"
|
||||
f" -0 sed -i '' 's/{k}/{replace}/g'",
|
||||
shell=True
|
||||
)
|
||||
print(k, v)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user