def display_xref(b64xref): xref = b64xref.decode("base64") h = XHTML().html h.head.link(rel="stylesheet", href="/cdastatic/cda.css") body = h.body(klass="xref") body.div.div(xref, klass="xrefstitle") if xref in xref_cache: for obj in xref_cache[xref]: linkobj = obj.replace("#",",")+","+b64xref body.div.a(obj, onclick="location.replace('#"+linkobj+"')", klass="filelink") return str(body)
def display_xref(b64xref): xref = b64xref.decode("base64") h = XHTML().html h.head.link(rel="stylesheet", href="/cdastatic/cda.css") body = h.body(klass="xref") body.div.div(xref, klass="xrefstitle") if xref in xref_cache: for obj in xref_cache[xref]: linkobj = obj.replace("#", ",") + "," + b64xref body.div.a(obj, onclick="location.replace('#" + linkobj + "')", klass="filelink") return str(body)
def write_html(options): """ read JSON file of images. """ # read the input folder h = XHTML() head = h.head() head.link(rel="stylesheet", href="style.css") body = h.body() outerdiv = body.div(style="margin:auto") with open(options.jsonfile) as infile: imgs = sort_images(json.load(infile)) # add horizontal pixel offset info imgs = px_offset_images(imgs) for img in imgs: h_shift = img['horiz_px_shift'] ic = outerdiv.div(klass="imgcontainer", style="position:relative;left:{}px".format(h_shift)) imgsrc = img['gmapstatic'] ic.img(src=imgsrc) with open(options.outputfile, 'w') as f: f.write(str(h))