blob: 52e545a601298d05db008e0f2bb4ab3ddc9e545f [file] [log] [blame]
onqtam5cab8e92016-10-10 17:58:38 +03001#!/usr/bin/python2.7
2
3import subprocess
4import fileinput
5
6# update main readme 'try it online' badge permalink
7print("updating main readme with up-to-date wandbox link")
onqtamb8220c52017-05-16 00:21:15 +03008proc = subprocess.Popen('python send_to_wandbox.py ../doctest/ ' + "../scripts/hello_world.cpp", stdout = subprocess.PIPE)
onqtam5cab8e92016-10-10 17:58:38 +03009url = proc.stdout.read().strip()
10
11readme_contents = ""
12for line in fileinput.input(["../README.md"]):
13 if line.startswith("[![Try it online]"):
onqtama3ae9582019-03-24 10:55:28 +020014 readme_contents += "[![Try it online](https://img.shields.io/badge/try%20it-online-orange.svg)](" + url + ")\n"
onqtam5cab8e92016-10-10 17:58:38 +030015 else:
16 readme_contents += line
17
18readme = open("../README.md", "w")
19readme.write(readme_contents)
20readme.close()