Commit e6987a74 authored by Yannick Chudy's avatar Yannick Chudy

added ethercalc /decalcograph

parent c39d2969
......@@ -51,6 +51,7 @@ def convert_url(url):
framapad expension auto add /export/txt
"""
re_ggdoc = "https?:\/\/docs.google.com/document/d/([0-9a-zA-Z\-_]+)/(edit)"
ggdoc = re.findall(re_ggdoc, url)
if len(ggdoc) :
......@@ -66,16 +67,16 @@ def convert_url(url):
url = "https://%s.framapad.org/p/%s/export/txt" % (frama[0], frama[1])
return url
#https://framacalc.org/uspaties
re_framacalc = "https?:\/\/framacalc.org/([0-9a-zA-Z\-_]+)([\.csv]+)?"
re_framacalc = "https?:\/\/(?:frama|ether)calc.org/([0-9a-zA-Z\-_]+)([\.csv]+)?"
frama = re.findall(re_framacalc, url)
debug( "convert_url", url , frama )
if len(frama) :
frama = [r for r in frama[0] if len(r)]
if len(frama) == 1 :
url = "https://framacalc.org/%s.csv" % (frama[0])
return url
#url = "https://framacalc.org/%s.csv" % (frama[0])
#url = "https://framacalc.org/%s.csv" % (frama[0])
return "%s.csv" % url
return url
......@@ -102,8 +103,8 @@ class Botapad(object):
def __init__(self, bot, gid, description, delete=False):
# Bot creation & login
log( "\n * Locating graph %s @ padagraph \n " % (gid) )
log( "\n * Locating graph %s @ padagraph \n " % (gid) )
self.gid = gid
self.imports = set()
......
......@@ -211,8 +211,15 @@ def home():
return render_template('homepage.html', **kw )
@app.route('/decalcograph/<string:gid>', methods=['GET'])
def decalcograph(gid):
padurl = "https://ethercalc.org/%s" % gid
graphurl = "/import/igraph.html?s=ethercalc&gid=%s&live=1&nofoot=1" % gid
return render_template('framagraph.html', graphurl=graphurl, padurl=padurl )
@app.route('/framagraph/<string:gid>', methods=['GET'])
def live(gid):
def framagraph(gid):
padurl = "https://annuel2.framapad.org/p/%s" % gid
graphurl = "/import/igraph.html?s=framapad&gid=%s&live=1&nofoot=1" % gid
......@@ -230,9 +237,7 @@ def googledoc(gid=None):
return render_template('framagraph.html', graphurl=graphurl, padurl=padurl )
def pad2pdg(gid, url):
......@@ -266,6 +271,7 @@ def import2pdg(repo='igraph', content=None):
return botimport('igraph', 'html')
def botimport(repo, content_type="html"):
#raise ValueError(request)
......@@ -304,6 +310,9 @@ def botimport(repo, content_type="html"):
elif pad_source == "google":
padurl = "https://docs.google.com/document/d/%s/edit" % gid
elif pad_source == "ethercalc":
padurl = "https://ethercalc.org/%s" % gid
if gid and padurl:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment