mirror of
https://github.com/zebrajr/ansible.git
synced 2025-12-06 12:19:53 +01:00
17 lines
461 B
Python
17 lines
461 B
Python
"""Unwrap URLs to docs.ansible.com and remove version"""
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
import sys
|
|
|
|
|
|
def main():
|
|
data = sys.stdin.read()
|
|
data = re.sub('(https://docs\\.ansible\\.com/[^ ]+)\n +([^ ]+)\n', '\\1\\2\n', data, flags=re.MULTILINE)
|
|
data = re.sub('https://docs\\.ansible\\.com/ansible(|-core)/(?:[^/]+)/', 'https://docs.ansible.com/ansible\\1/devel/', data)
|
|
sys.stdout.write(data)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|