my eye

author Angelo Gladding

name mf2json

published 2025-07-10T21:32:22.798022-07:00

type entry

updated 2025-07-11T14:29:29.774213-07:00

url /mf2json, /2025/07/11/on

visibility public

Content

$ form = web.form(url="https://ragt.ag", format="html")
$ mf2json = http[form.url].mf2json

$if form.format == "html":
    <form>
    <label>URL: <input name=url value="$form.url"></label>
    <button>Parse</button>
    </form>
    <p><a href=/mf2json?url=$form.url&format=json download>Download</a></p>
    <p>Bookmarklet: <a href="javascript:(function()%7Bwindow.location.href='https://ragt.ag/mf2json?url='+encodeURIComponent(window.location.href)%7D)()">µf</a> <small>(drag to browser toolbar to install)</small></p>
    <pre style=font-size:.65em>$:pformat(mf2json)</pre>
$elif form.format == "json" or "application/json" in web.tx.request.headers.accept:
    $ web.tx.response.headers.content_type = "application/json"
    $ web.tx.response.embeddable = True
    {}