From 24d63cd8a9ace35d0b3d29d6a2369bb62712c2d6 Mon Sep 17 00:00:00 2001 From: Alex Palaistras Date: Sun, 25 Aug 2019 16:30:34 +0100 Subject: [PATCH] Implement initial version of Grawkit Web Playground Running `grawkit` locally can be a hassle for one-off tasks, and can be hard to iterate against when plotting graphs based on complex command-line descriptions. Given recent fixes for POSIX compatibility, this commit implements a basic web-based "playground"-style application that allows for entering command-line descriptions in an HTML textarea, and seeing the results (or errors) instantly. The playground application itself is built in Go (Awk itself would be insufficient for the throughput required, but may be investigated in the future), with the excellent GoAwk library providing parsing and execution duties, therefore making for a pure-Go implementation (other than Grawkit itself). Additional support for setting custom styling and an online deployment with Docker are forthcoming. --- LICENSE | 4 +- play/README.md | 21 + play/go.mod | 5 + play/go.sum | 2 + play/play.go | 187 ++++++++ play/static/apple-touch-icon.png | Bin 0 -> 8059 bytes play/static/css/main.css | 122 +++++ play/static/css/normalize.css | 427 ++++++++++++++++++ play/static/css/skeleton.css | 418 +++++++++++++++++ play/static/favicon.ico | Bin 0 -> 4286 bytes play/static/img/logo.png | Bin 0 -> 7055 bytes play/static/js/main.js | 42 ++ play/static/template/default-content.template | 11 + play/static/template/default-preview.template | 26 ++ play/static/template/index.template | 49 ++ 15 files changed, 1312 insertions(+), 2 deletions(-) create mode 100644 play/README.md create mode 100644 play/go.mod create mode 100644 play/go.sum create mode 100644 play/play.go create mode 100644 play/static/apple-touch-icon.png create mode 100644 play/static/css/main.css create mode 100644 play/static/css/normalize.css create mode 100644 play/static/css/skeleton.css create mode 100644 play/static/favicon.ico create mode 100644 play/static/img/logo.png create mode 100644 play/static/js/main.js create mode 100644 play/static/template/default-content.template create mode 100644 play/static/template/default-preview.template create mode 100644 play/static/template/index.template diff --git a/LICENSE b/LICENSE index 1777578..24e4d44 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016 Alex Palaistras +Copyright (c) 2019 Alex Palaistras Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file +THE SOFTWARE. diff --git a/play/README.md b/play/README.md new file mode 100644 index 0000000..d4d9a88 --- /dev/null +++ b/play/README.md @@ -0,0 +1,21 @@ +# The Grawkit Playground + +This folder contains an interactive version of Grawkit that can be run in a web-browser (Javascript +support optional), built entirely in Go. Once built, this depends only on the contents of the +`static` directory, as well as the `grawkit` script itself for operation. + +Execution of Grawkit is done with [`goawk`](https://github.com/benhoyt/goawk), a POSIX-compatible +AWK implementation built entirely in Go, and used here as a library. + +## Installation & Usage + +Only a fairly recent version of Go is required to build this package, and the included `play.go` +file can be executed on-the-fly using `go run`. + +The program expects to find a `static` directory (which is provided alongside the source code +here), as well as the `grawkit` script; by default, these are expected to be found in the current +and parent directories, respectively. Alternatively, their locations may be set using command-line +arguments, run `play -help` for more. + +By default, this will bind an HTTP server on port `8080`, though this can also be modified using +the command-line arguments. Run `play -help` for more. diff --git a/play/go.mod b/play/go.mod new file mode 100644 index 0000000..aeb0fec --- /dev/null +++ b/play/go.mod @@ -0,0 +1,5 @@ +module github.com/deuill/grawkit/play + +go 1.12 + +require github.com/benhoyt/goawk v1.6.0 diff --git a/play/go.sum b/play/go.sum new file mode 100644 index 0000000..6a48630 --- /dev/null +++ b/play/go.sum @@ -0,0 +1,2 @@ +github.com/benhoyt/goawk v1.6.0 h1:6oHKBL2BAvYiKroi8RhmpnhyvMGeiW5u/WEaxyOcKRQ= +github.com/benhoyt/goawk v1.6.0/go.mod h1:krl47rWeW8s+kD3dtHYm6aq4MBGRzQD5PGkZaRm38Uk= diff --git a/play/play.go b/play/play.go new file mode 100644 index 0000000..3355996 --- /dev/null +++ b/play/play.go @@ -0,0 +1,187 @@ +package main + +import ( + // Standard library + "bytes" + "errors" + "flag" + "io/ioutil" + "log" + "net" + "net/http" + "net/url" + "os" + "os/signal" + "path" + "syscall" + "text/template" + "time" + + // Third-party packages + "github.com/benhoyt/goawk/interp" + "github.com/benhoyt/goawk/parser" +) + +const ( + // Error messages. + errReadRequest = "Error reading request, please try again" + errValidate = "Error validating content" + errRender = "Error rendering preview" + + // The maximum content size we're going to parse. + maxContentSize = 4096 +) + +var ( + // Command-line flags to parse. + scriptPath = flag.String("script-path", "../grawkit", "The path to the Grawkit script") + staticDir = flag.String("static-dir", "static", "The directory under which static files can be found") + listenAddress = flag.String("listen-address", "localhost:8080", "The default address to listen on") + + index *template.Template // The base template to render. + program *parser.Program // The parsed version of the Grawkit script. +) + +type templateData struct { + Content string + Preview string + Error string +} + +// ParseContent accepts un-filtered POST form content, and returns the content to render as a string. +// An error is returned if the content is missing or otherwise invalid. +func parseContent(form url.Values) (string, error) { + if _, ok := form["content"]; !ok || len(form["content"]) == 0 { + return "", errors.New("missing or empty content") + } + + var content = form["content"][0] + switch true { + case len(content) > maxContentSize: + return "", errors.New("content too large") + } + + return content, nil +} + +// HandleRequest accepts a GET or POST HTTP request and responds appropriately based on given data +// and pre-parsed template files. For GET requests not against the document root, HandleRequest will +// attempt to find and return the contents of an equivalent file under the configured static directory. +func handleRequest(w http.ResponseWriter, r *http.Request) { + // Handle template rendering on root path. + if r.URL.Path == "/" { + var data templateData + var outbuf, errbuf bytes.Buffer + + switch r.Method { + case "POST": + if err := r.ParseForm(); err != nil { + data.Error = errReadRequest + } else if data.Content, err = parseContent(r.PostForm); err != nil { + data.Error = errValidate + ": " + err.Error() + } else { + config := &interp.Config{ + Stdin: bytes.NewReader([]byte(data.Content)), + Output: &outbuf, + Error: &errbuf, + } + + // Render generated preview from content given. + if n, err := interp.ExecProgram(program, config); err != nil { + data.Error = errRender + } else if n != 0 { + data.Error = "Error: " + string(errbuf.Bytes()) + } else if _, ok := r.PostForm["generate"]; ok { + data.Preview = string(outbuf.Bytes()) + } else if _, ok = r.PostForm["download"]; ok { + w.Header().Set("Content-Disposition", `attachment; filename="generated.svg"`) + http.ServeContent(w, r, "generated.svg", time.Now(), bytes.NewReader(outbuf.Bytes())) + return + } + } + + fallthrough + case "GET": + // Set correct status code and error message, if any. + if data.Error != "" { + w.Header().Set("X-Error-Message", data.Error) + w.WriteHeader(http.StatusBadRequest) + } + + // Render index page template. + if err := index.Execute(w, data); err != nil { + log.Printf("error rendering template: %s", err) + } + } + + return + } + + // Get sanitized filename for request path given. + name := path.Join(*staticDir, path.Clean(r.URL.Path)) + + // Check if a file exists for the path requested. + stat, err := os.Stat(name) + if os.IsNotExist(err) || stat != nil && stat.IsDir() { + http.NotFound(w, r) + return + } else if err != nil { + code := http.StatusInternalServerError + http.Error(w, http.StatusText(code), code) + return + } + + // Serve file as fallback. + http.ServeFile(w, r, name) +} + +// Setup reads configuration flags and initializes global state for the service, returning an error +// if any of the service pre-requisites are not fulfilled. +func setup() error { + // Set up command-line flags. + flag.Parse() + + // Set up and parse known template files. + var err error + var files = []string{ + path.Join(*staticDir, "template", "index.template"), + path.Join(*staticDir, "template", "default-content.template"), + path.Join(*staticDir, "template", "default-preview.template"), + } + + if index, err = template.ParseFiles(files...); err != nil { + return err + } + + // Parse Grawkit script into concrete representation. + if script, err := ioutil.ReadFile(*scriptPath); err != nil { + return err + } else if program, err = parser.ParseProgram(script, nil); err != nil { + return err + } + + return nil +} + +func main() { + // Set up base service dependencies. + if err := setup(); err != nil { + log.Fatalf("Failed setting up service: %s", err) + } + + // Set up TCP socket and handlers for HTTP server. + ln, err := net.Listen("tcp", *listenAddress) + if err != nil { + log.Fatalf("Failed listening on address '%s': %s", *listenAddress, err) + } + + // Listen on given address and wait for INT or TERM signals. + log.Println("Listening on " + *listenAddress + "...") + go http.Serve(ln, http.HandlerFunc(handleRequest)) + + halt := make(chan os.Signal, 1) + signal.Notify(halt, syscall.SIGINT, syscall.SIGTERM) + + <-halt + log.Println("Shutting down listener...") +} diff --git a/play/static/apple-touch-icon.png b/play/static/apple-touch-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a2159dc66e0bcbbc1ab9f74aa587eafa6bb6a5f3 GIT binary patch literal 8059 zcmb7JWmr_*x1V8Ts38>?x{+p-?oOqVjv+)ux>JXe7HK3DPz31?si8p-q`SL8kdAwN z|L?tD?uYx_^E~G{YscDq#o24`_1h7e>Pq;yl(--e2wz26UK<1g!~ee6P@pF4-BvVE z2zeP<*NAK+FWb@MgIS9lS7Z4|*+%8SsX|9v2z=`WguOL<__;q5#d>vcx!bpXmX zvrHR%L}2UN`LxT*QnZo-YDO$Cbcu+u_+Z$T!OXHK(!9U4vSXU~!spYK+eyA*6j(CO zJDI{J)H~SQx6;yi{vknSP!Y+e`>`L~WtNpnIC)xJ2E@1y`^!G44%`om==7)Jbm+(Z zswl2NttF88JG82gV}pCZ=-ZF9vsGT$^FK+?OGc<=siO>n?h)e_u;ql{=2UHeF;E_U z-QO;?dCua>zRD34X9a$4`<_PXobGym{D+!)ok}+R*M;Q_9g{SY+;-Id>T0rv>LKcm zqHfsu)|Dppg1KpYm{CdkK+xG`Za7h5(G?5s{n%Q^lUYiQAq6r&xS9S~`i}co_4?`f zZ1)!AeNG995W1BCk(RgX5$lCD<9BuTw6cXR)xfnTs^H)Za0}G(iIP0<1)dAJhBv?m z$649X4e;Q^-xn;)mhKHyV!5lRDPXN&;}PR=gTBjEgFrOiD)KVA-qU+?UhcZj=dlhC zs`{Zc3lVHb@kc4Q;=k`)sE4(-R!o9s7;G(5Pl*@*ZQ)FO9&8YB&oj!-2 zKIkN#o(S>f>|?KWJo^D14hP=m?CLx--`SN&_ln5*?DB!+@ml>}J#NDsK^!~y1pEsk z4MVYk7(mycO)#6Zyjmwg7KtM5ufGyoAMSR?|ar&8&JKR_6PK7(MGM1*Mcit?(v zD##y##6t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C(LC~Qg`dGa5I@2%kxvrgD3dPV`zgLu*$N8rcF~QocWOzATFqLbTy>0 zsi}PX&jdo0=c`$t-?wLzcl)jYA;VDWW2MDZ%VtP@g`QL7?v~(&tW46)P;SK zMaDNuV{M^$PPIs=-A3dVh~8lT*~!U?^mV|^;&TD3g(>E+6hF4F5`sn6b^Iwqwkg<7 z9aWl3wgtpVg54>mlOu#UM;7st`YR#o7~VMO+nMoM$GZ`BA1sIgcGklkoXI^;W>!=5 zceV6#`@WKy8b5?6?#P`W1?2KiU_*l#-b6ourdpkS^Y?eIxi>Xdt4^7TkviUr$K-pD zkxO$hXHMMJFkGrWaakD+l6C^&ZMVJMen3Xbux7+jQCX?=^0Cb4arEFI`BHKFFHx@O zQiyP%T@?O=Yjh7=k!-{eMj^g!wmw6LepGle?V-DVrLxeBsh5%as)kYw0Ti~ap0JML z9rTAKzW7;wQ&#%gub1CYsCq|Slp#p8a$LS5E_`~!M3SsRGXMh$G6JW9k)j~TD~;6( zRn4pOJJst6Id^SnzsLXFD`Eooiqd<=Lv%}C2V?@CXp=ll1TI<=bVNNyB(i6_Mm4HV zR!!ld!^0n906z9p1qFakKtvFFTxo2O6v!9kFBhG^HK}zaFd;iCxse<_%^O9nw0Au# d_(e*rhOKO+DD literal 0 HcmV?d00001 diff --git a/play/static/css/main.css b/play/static/css/main.css new file mode 100644 index 0000000..40ae537 --- /dev/null +++ b/play/static/css/main.css @@ -0,0 +1,122 @@ +html, body { + min-height: 100%; +} + +html { + height: 100%; +} + +body { + background: #fff repeat center fixed; + color: #333; + font-family: Nunito, Helvetica, sans-serif; + font-size: 1.6rem; +} + +h1 {font-size: 3.6rem; line-height: 1.2; letter-spacing: 0;} +h2 {font-size: 2.6rem; line-height: 1.25; letter-spacing: 0;} +h3 {font-size: 2.2rem; line-height: 1.3; letter-spacing: 0;} +h4 {font-size: 1.8rem; line-height: 1.35; letter-spacing: 0;} +h5 {font-size: 1.4rem; line-height: 1.5; letter-spacing: 0;} +h6 {font-size: 1.2rem; line-height: 1.6; letter-spacing: 0;} + +p { + margin-bottom: 1.5rem; +} + +ul, ol { + list-style: disc outside; + padding-left: 2rem; +} +code { + background-color: #f8f8f8; + border-color: #f1f1f1; + border-radius: 0; + font-size: 100%; +} + +a { + color: #c31; + transition: background .2s ease, border .2s ease, box-shadow .2s ease, color .2s ease, top .2s ease; +} + +a:hover, a:active { + color: #111; +} + +.button { + background: #fff; + border: 0.2rem solid #333; + border-radius: 0; + box-shadow: 0 0.2rem #333; + color: #333; + font-size: 1.35rem; + font-weight: 600; + font-variant: small-caps; + padding: 0 0.5rem 0.25rem; + position: relative; + text-transform: none; + top: 0; +} + +.button:hover, .button:focus { + background: #fff; + border-color: #c31; + box-shadow: 0 0 #c31; + color: #333; + top: 0.2rem; +} + +.preview-header { + padding: 1rem 0; +} + +.preview-header a { + color: #333; + text-decoration: none; +} + +.preview-header .title { + display: inline-block; + font-weight: bold; + line-height: 1.2; + padding-bottom: 1rem; + margin-right: 1rem; +} + +.preview-header .logo { + max-height: 3.5rem; +} + +.preview-header .button { + margin-right: 1rem; +} + +.editor { + background: #f8f8f8; + border: none; + font-family: monospace; + height: 65rem; + overflow: auto; + resize: none; + white-space: pre-wrap; + width: 100%; +} + +.editor:focus { + border: none; +} + +.preview-generated { + height: 65rem; + width: 100%; +} + +.preview-generated svg { + max-height: 100%; +} + +.error { + color: #cc0000; + padding: 0 1rem; +} diff --git a/play/static/css/normalize.css b/play/static/css/normalize.css new file mode 100644 index 0000000..81c6f31 --- /dev/null +++ b/play/static/css/normalize.css @@ -0,0 +1,427 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} \ No newline at end of file diff --git a/play/static/css/skeleton.css b/play/static/css/skeleton.css new file mode 100644 index 0000000..f28bf6c --- /dev/null +++ b/play/static/css/skeleton.css @@ -0,0 +1,418 @@ +/* +* Skeleton V2.0.4 +* Copyright 2014, Dave Gamache +* www.getskeleton.com +* Free to use under the MIT license. +* http://www.opensource.org/licenses/mit-license.php +* 12/29/2014 +*/ + + +/* Table of contents +–––––––––––––––––––––––––––––––––––––––––––––––––– +- Grid +- Base Styles +- Typography +- Links +- Buttons +- Forms +- Lists +- Code +- Tables +- Spacing +- Utilities +- Clearing +- Media Queries +*/ + + +/* Grid +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +.container { + position: relative; + width: 100%; + max-width: 960px; + margin: 0 auto; + padding: 0 20px; + box-sizing: border-box; } +.column, +.columns { + width: 100%; + float: left; + box-sizing: border-box; } + +/* For devices larger than 400px */ +@media (min-width: 400px) { + .container { + width: 85%; + padding: 0; } +} + +/* For devices larger than 550px */ +@media (min-width: 550px) { + .container { + width: 80%; } + .column, + .columns { + margin-left: 4%; } + .column:first-child, + .columns:first-child { + margin-left: 0; } + + .one.column, + .one.columns { width: 4.66666666667%; } + .two.columns { width: 13.3333333333%; } + .three.columns { width: 22%; } + .four.columns { width: 30.6666666667%; } + .five.columns { width: 39.3333333333%; } + .six.columns { width: 48%; } + .seven.columns { width: 56.6666666667%; } + .eight.columns { width: 65.3333333333%; } + .nine.columns { width: 74.0%; } + .ten.columns { width: 82.6666666667%; } + .eleven.columns { width: 91.3333333333%; } + .twelve.columns { width: 100%; margin-left: 0; } + + .one-third.column { width: 30.6666666667%; } + .two-thirds.column { width: 65.3333333333%; } + + .one-half.column { width: 48%; } + + /* Offsets */ + .offset-by-one.column, + .offset-by-one.columns { margin-left: 8.66666666667%; } + .offset-by-two.column, + .offset-by-two.columns { margin-left: 17.3333333333%; } + .offset-by-three.column, + .offset-by-three.columns { margin-left: 26%; } + .offset-by-four.column, + .offset-by-four.columns { margin-left: 34.6666666667%; } + .offset-by-five.column, + .offset-by-five.columns { margin-left: 43.3333333333%; } + .offset-by-six.column, + .offset-by-six.columns { margin-left: 52%; } + .offset-by-seven.column, + .offset-by-seven.columns { margin-left: 60.6666666667%; } + .offset-by-eight.column, + .offset-by-eight.columns { margin-left: 69.3333333333%; } + .offset-by-nine.column, + .offset-by-nine.columns { margin-left: 78.0%; } + .offset-by-ten.column, + .offset-by-ten.columns { margin-left: 86.6666666667%; } + .offset-by-eleven.column, + .offset-by-eleven.columns { margin-left: 95.3333333333%; } + + .offset-by-one-third.column, + .offset-by-one-third.columns { margin-left: 34.6666666667%; } + .offset-by-two-thirds.column, + .offset-by-two-thirds.columns { margin-left: 69.3333333333%; } + + .offset-by-one-half.column, + .offset-by-one-half.columns { margin-left: 52%; } + +} + + +/* Base Styles +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +/* NOTE +html is set to 62.5% so that all the REM measurements throughout Skeleton +are based on 10px sizing. So basically 1.5rem = 15px :) */ +html { + font-size: 62.5%; } +body { + font-size: 1.5em; /* currently ems cause chrome bug misinterpreting rems on body element */ + line-height: 1.6; + font-weight: 400; + font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; + color: #222; } + + +/* Typography +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +h1, h2, h3, h4, h5, h6 { + margin-top: 0; + margin-bottom: 2rem; + font-weight: 300; } +h1 { font-size: 4.0rem; line-height: 1.2; letter-spacing: -.1rem;} +h2 { font-size: 3.6rem; line-height: 1.25; letter-spacing: -.1rem; } +h3 { font-size: 3.0rem; line-height: 1.3; letter-spacing: -.1rem; } +h4 { font-size: 2.4rem; line-height: 1.35; letter-spacing: -.08rem; } +h5 { font-size: 1.8rem; line-height: 1.5; letter-spacing: -.05rem; } +h6 { font-size: 1.5rem; line-height: 1.6; letter-spacing: 0; } + +/* Larger than phablet */ +@media (min-width: 550px) { + h1 { font-size: 5.0rem; } + h2 { font-size: 4.2rem; } + h3 { font-size: 3.6rem; } + h4 { font-size: 3.0rem; } + h5 { font-size: 2.4rem; } + h6 { font-size: 1.5rem; } +} + +p { + margin-top: 0; } + + +/* Links +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +a { + color: #1EAEDB; } +a:hover { + color: #0FA0CE; } + + +/* Buttons +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +.button, +button, +input[type="submit"], +input[type="reset"], +input[type="button"] { + display: inline-block; + height: 38px; + padding: 0 30px; + color: #555; + text-align: center; + font-size: 11px; + font-weight: 600; + line-height: 38px; + letter-spacing: .1rem; + text-transform: uppercase; + text-decoration: none; + white-space: nowrap; + background-color: transparent; + border-radius: 4px; + border: 1px solid #bbb; + cursor: pointer; + box-sizing: border-box; } +.button:hover, +button:hover, +input[type="submit"]:hover, +input[type="reset"]:hover, +input[type="button"]:hover, +.button:focus, +button:focus, +input[type="submit"]:focus, +input[type="reset"]:focus, +input[type="button"]:focus { + color: #333; + border-color: #888; + outline: 0; } +.button.button-primary, +button.button-primary, +input[type="submit"].button-primary, +input[type="reset"].button-primary, +input[type="button"].button-primary { + color: #FFF; + background-color: #33C3F0; + border-color: #33C3F0; } +.button.button-primary:hover, +button.button-primary:hover, +input[type="submit"].button-primary:hover, +input[type="reset"].button-primary:hover, +input[type="button"].button-primary:hover, +.button.button-primary:focus, +button.button-primary:focus, +input[type="submit"].button-primary:focus, +input[type="reset"].button-primary:focus, +input[type="button"].button-primary:focus { + color: #FFF; + background-color: #1EAEDB; + border-color: #1EAEDB; } + + +/* Forms +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +input[type="email"], +input[type="number"], +input[type="search"], +input[type="text"], +input[type="tel"], +input[type="url"], +input[type="password"], +textarea, +select { + height: 38px; + padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */ + background-color: #fff; + border: 1px solid #D1D1D1; + border-radius: 4px; + box-shadow: none; + box-sizing: border-box; } +/* Removes awkward default styles on some inputs for iOS */ +input[type="email"], +input[type="number"], +input[type="search"], +input[type="text"], +input[type="tel"], +input[type="url"], +input[type="password"], +textarea { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; } +textarea { + min-height: 65px; + padding-top: 6px; + padding-bottom: 6px; } +input[type="email"]:focus, +input[type="number"]:focus, +input[type="search"]:focus, +input[type="text"]:focus, +input[type="tel"]:focus, +input[type="url"]:focus, +input[type="password"]:focus, +textarea:focus, +select:focus { + border: 1px solid #33C3F0; + outline: 0; } +label, +legend { + display: block; + margin-bottom: .5rem; + font-weight: 600; } +fieldset { + padding: 0; + border-width: 0; } +input[type="checkbox"], +input[type="radio"] { + display: inline; } +label > .label-body { + display: inline-block; + margin-left: .5rem; + font-weight: normal; } + + +/* Lists +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +ul { + list-style: circle inside; } +ol { + list-style: decimal inside; } +ol, ul { + padding-left: 0; + margin-top: 0; } +ul ul, +ul ol, +ol ol, +ol ul { + margin: 1.5rem 0 1.5rem 3rem; + font-size: 90%; } +li { + margin-bottom: 1rem; } + + +/* Code +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +code { + padding: .2rem .5rem; + margin: 0 .2rem; + font-size: 90%; + white-space: nowrap; + background: #F1F1F1; + border: 1px solid #E1E1E1; + border-radius: 4px; } +pre > code { + display: block; + padding: 1rem 1.5rem; + white-space: pre; } + + +/* Tables +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +th, +td { + padding: 12px 15px; + text-align: left; + border-bottom: 1px solid #E1E1E1; } +th:first-child, +td:first-child { + padding-left: 0; } +th:last-child, +td:last-child { + padding-right: 0; } + + +/* Spacing +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +button, +.button { + margin-bottom: 1rem; } +input, +textarea, +select, +fieldset { + margin-bottom: 1.5rem; } +pre, +blockquote, +dl, +figure, +table, +p, +ul, +ol, +form { + margin-bottom: 2.5rem; } + + +/* Utilities +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +.u-full-width { + width: 100%; + box-sizing: border-box; } +.u-max-full-width { + max-width: 100%; + box-sizing: border-box; } +.u-pull-right { + float: right; } +.u-pull-left { + float: left; } + + +/* Misc +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +hr { + margin-top: 3rem; + margin-bottom: 3.5rem; + border-width: 0; + border-top: 1px solid #E1E1E1; } + + +/* Clearing +–––––––––––––––––––––––––––––––––––––––––––––––––– */ + +/* Self Clearing Goodness */ +.container:after, +.row:after, +.u-cf { + content: ""; + display: table; + clear: both; } + + +/* Media Queries +–––––––––––––––––––––––––––––––––––––––––––––––––– */ +/* +Note: The best way to structure the use of media queries is to create the queries +near the relevant code. For example, if you wanted to change the styles for buttons +on small devices, paste the mobile query code up in the buttons section and style it +there. +*/ + + +/* Larger than mobile */ +@media (min-width: 400px) {} + +/* Larger than phablet (also point when grid becomes active) */ +@media (min-width: 550px) {} + +/* Larger than tablet */ +@media (min-width: 750px) {} + +/* Larger than desktop */ +@media (min-width: 1000px) {} + +/* Larger than Desktop HD */ +@media (min-width: 1200px) {} diff --git a/play/static/favicon.ico b/play/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..566f67271cd985c4d6685a26f120646442cefeed GIT binary patch literal 4286 zcmd6q&r2IY6vv+w>BV9_)QhMQ>#rn4MU$wYiD13>2jt$;dhifRL63?TZ;CziQbj=o z&xJNZdkBTno1mpX@FWz2UP@b9sA7HnzSY%rGRp2|=sNOscZYfJ^JX&hW`?K?f1wb` ze_FduR82&!5UMB*Nxg{@Ya&Xv5hWtj0j)q^pbyYfs5TxYYOXaw();K>VQ0WPgjmrx ze0R0f>1|Ea!ha3)Tj4t6*iMA0+yqPK1KjZ|*mfL4I$INUU@y4fkC|ZUe1N^|f}hpd zny3qsA8xSL-IAOBmm8je-7OY-80>-z{wCT)`r1v5IPwh=8T>thj$E+qHSiN{Q}+f- zj{$y0puZm2b__pY(_Bgf@d#DGN70z~cirLn*%^NGI>)(}FL-)#+-9oJd`|@F-)8~) zvD)v^`x)Nd{mN?j^l^(vhB{Tge5d^2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8FV z1<$bR#WipFfh3CI8$?Vu|H!lpWS0YtvA_4*jxRV7EOTv9?9d6F<`F@pubHsqrn&u% zg|P7VFdX}5m$>2zwm;X%Y2i=FCu5NHip=zRJt@R3vrL{uMg}*zd~$hmF!LuS=X#56 zTtR%os|6#6)0uG0%_E;P>`vS>)7IWu%SON#fSsIS6>f_VnLYg%^KQWS=Uq|O=7d7X zu@_TTmadzFC3BDnnVnHmhYz0G)a-1h+!EM<4)5f1UXP8WT&1WX<}(&0w_0HEGefSO zM!V<=S8+thdEMe=J zwd)LxSa$?k%r?21WtERJA1hL#|r-mq@U{sz&r4T&m=r?YD!eJi9dJ}(a!N!~jZ zIv}jIDXZsC#1BewRs6vc?A6H;6YN10YOYr7UTjRmO5yZ%r0;TH(Zj zR}9g_@DM8(Sj5k|BO}mgo#)DD?nMSVk1lt*{!jp%_Vl*@NWUR{dJjk8owk;RjPElw zAB0u?NG85olj%vTyyST3yjmB8FOmZyF=c;{CpG(}TEp`X=ig~CrA$fNh+I1B=uKG9 zcZgyfwY()=DiuNMax_D=38!N^=>%(t2)UuSsyRwlu<@Qgf9!m;Qv}02>p%K_UlPa2 z8n)N#BW(_tKot{hz}P=;7NR;M3ma zCkS8WpL=z!p#us@W}XH=_`o|7^>Op+GmXNDwq&)6+J9`o5=p(21=lUYru=+mebRlB zseGY5O|K!;Kk=Cq`ph$Gez@1|BEJ$Aq=71a;ujJY_FI+EeWHAS@8sSz<+v;9=pVG$ z=Sk|R{36!$LB%3xc|4i?QhT7)7?mr}0~EK0=DSpZa7uG}cWa?%;5^1M%bgoZ{q%{V V6`)ir?pF<-o|chjojN%Be*pQF^11*3 literal 0 HcmV?d00001 diff --git a/play/static/js/main.js b/play/static/js/main.js new file mode 100644 index 0000000..fcd49a2 --- /dev/null +++ b/play/static/js/main.js @@ -0,0 +1,42 @@ +var submitForm = function(el) { + if (!el.action) { + return false; + } + + var req = new XMLHttpRequest(); + req.open('POST', el.action); + req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + + req.onreadystatechange = function() { + if (this.readyState != 4) { + return; + } + + if (this.status == 200) { + document.getElementById('generated').innerHTML = this.responseText; + document.getElementById('error').innerHTML = ''; + } else { + document.getElementById('error').innerHTML = this.getResponseHeader('X-Error-Message'); + } + }; + + var data = encodeFormData(new FormData(el)) + '&download'; + req.send(data); + + return true; +}; + +var encodeFormData = function(data) { + var encode = function(s) { + return encodeURIComponent(s).replace(/%20/g, '+'); + }; + + var result = ''; + for (var entry of data.entries()) { + if (typeof entry[1] == 'string') { + result += (result ? '&' : '') + encode(entry[0]) + '=' + encode(entry[1]); + } + } + + return result; +}; diff --git a/play/static/template/default-content.template b/play/static/template/default-content.template new file mode 100644 index 0000000..24d8d4b --- /dev/null +++ b/play/static/template/default-content.template @@ -0,0 +1,11 @@ +git commit -m "Commit on master" +git commit -m "More stuff" + +git branch test-stuff +git checkout test-stuff + +git commit -m "Testing stuff" +git commit + +git checkout master +git commit diff --git a/play/static/template/default-preview.template b/play/static/template/default-preview.template new file mode 100644 index 0000000..77f2cb8 --- /dev/null +++ b/play/static/template/default-preview.template @@ -0,0 +1,26 @@ +

About the Grawkit Playground

+

+ This is an online version of the Grawkit tool for + building SVG graphs based on command-line descriptions of git commands. +

+

+ Simply fill in the textarea with git commands, as you would enter these in the + command-line, and press 'Generate' to return an SVG graph representation. +

+

Features

+

+ This can currently parse the following (to varying degrees): +

+
    +
  • git branch for creating named branches
  • +
  • git commit for adding commit markers on branches
  • +
  • git checkout for changing branch contexts
  • +
  • git merge for generating merges between branches
  • +
  • git tag for adding labels to specific commits
  • +
+

Feedback & More Information

+

+ For a full list of features, as well as for requesting new features, check the + Github page or feel free to + contact me. +

diff --git a/play/static/template/index.template b/play/static/template/index.template new file mode 100644 index 0000000..72ffec1 --- /dev/null +++ b/play/static/template/index.template @@ -0,0 +1,49 @@ + + + + + + Grawkit Playground + + + + + + + + + + + +
+
+
+ +
+
+ + +
+
+
+
+
+ +
+
+
{{if .Preview}}{{printf .Preview}}{{else}}{{template "default-preview.template"}}{{end}}
+
+
+ +
+
+ + +