github.com/vugu/vugu@v0.3.5/vugufmt/README.md (about) 1 # vugufmt 2 3 gofmt, but for vugu and html files. 4 5 ## Goals 6 7 * Match args and output as closely as possible to the original gofmt's general usecase. 8 * Wrap around the actual gofmt; don't copy its code here. 9 * Format HTML5 in addition to go source. 10 * Report correct absolute line numbers and file names in the output. 11 * Pure go implementation. 12 13 ## Non-Goals 14 15 * Support versions of HTML other than HTML5. 16 17 ## Stretch-Goals 18 19 * Pretty fmt'ing CSS. A lot of CSS these days is generated by a preprocessor like SASS or LESS. 20 21 ## Implementation 22 23 1. Use `golang.org/x/net/html` to parse the vugu file. This will probably need a tweak to handle the lack of a single root element, missing body, etc. This package has a Render function which re-prints the HTML parse tree, which we will use as the formatted output. 24 2. Pass in text data for `<script type="application/x-go">` tags into gofmt. Capture its output. 25 26 ## Sources 27 28 This project took a lot of its code from [gofmt](https://golang.org/src/cmd/gofmt/gofmt.go) and Go's Token file. As such, I'm using the same license as gofmt.