view bin/url @ 12268:6bbbe2a95120 draft

<b_jonas> slashlearn euclid//Euclid is a short geeky game in which the goal is to do Euclidean compass and straightedge constructions in as few steps as possible. It runs in the browser, found at "http://www.euclidthegame.com/". It was popular among #esoteric regulars in 2016-07.
author HackEso <hackeso@esolangs.org>
date Mon, 16 Dec 2019 23:02:52 +0000
parents ff752d36eb0e
children
line wrap: on
line source

#!/usr/bin/env python
import sys, os.path, re, urllib
if len(sys.argv) <= 1:
    print "https://hack.esolangs.org/repo/"
else:
    f = os.path.abspath(sys.argv[1])
    f = re.sub(r"^/+hackenv/", "", f)
    if re.match(r"/|\.hg(?:/|$)",f):
        sys.exit("File is outside web-viewable filesystem repository.")
    elif re.match(r"tmp(?:/|$)",f):
        print ("https://hack.esolangs.org/" + urllib.quote(f))
    else:
        print ("https://hack.esolangs.org/repo/file/tip/" +
            urllib.quote(f))