onqtam | 5cab8e9 | 2016-10-10 17:58:38 +0300 | [diff] [blame] | 1 | #!/usr/bin/python2.7 |
| 2 | |
| 3 | import subprocess |
| 4 | import fileinput |
| 5 | |
| 6 | # update main readme 'try it online' badge permalink |
| 7 | print("updating main readme with up-to-date wandbox link") |
onqtam | b8220c5 | 2017-05-16 00:21:15 +0300 | [diff] [blame] | 8 | proc = subprocess.Popen('python send_to_wandbox.py ../doctest/ ' + "../scripts/hello_world.cpp", stdout = subprocess.PIPE) |
onqtam | 5cab8e9 | 2016-10-10 17:58:38 +0300 | [diff] [blame] | 9 | url = proc.stdout.read().strip() |
| 10 | |
| 11 | readme_contents = "" |
| 12 | for line in fileinput.input(["../README.md"]): |
| 13 | if line.startswith("[![Try it online]"): |
onqtam | a3ae958 | 2019-03-24 10:55:28 +0200 | [diff] [blame] | 14 | readme_contents += "[![Try it online](https://img.shields.io/badge/try%20it-online-orange.svg)](" + url + ")\n" |
onqtam | 5cab8e9 | 2016-10-10 17:58:38 +0300 | [diff] [blame] | 15 | else: |
| 16 | readme_contents += line |
| 17 | |
| 18 | readme = open("../README.md", "w") |
| 19 | readme.write(readme_contents) |
| 20 | readme.close() |