Source code for Pushup page view-source.up for the route /view-source:
^import "strings"
^handler {
route := req.FormValue("route")
routeMatch := getRouteFromPath(route)
if routeMatch.response == routeNotFound {
http.Error(w, http.StatusText(404), 404)
return nil
}
path := routeMatch.route.path
// FIXME(paulsmith): this should be a routePathToFilepath API method
var fpath string
if path[len(path)-1] == '/' {
fpath = path + "index.up"
} else {
fpath = path + ".up"
}
if fpath[0] == '/' {
fpath = fpath[1:]
}
fpath = strings.ReplaceAll(fpath, ":", "$")
source := string(GetPageSource(fpath))
}
<p>Source code for Pushup page <tt>^fpath</tt> for the route <a href="^path"><b>^path</b></a>:</p>
<style>
pre {
padding: 1em;
background: #f3f4f0;
overflow-x: scroll;
}
</style>
<pre><code>^source</code></pre>