ajstarks/svgo — pull request #16 by gbulmer (2014-10-24 16:02:41+00:00)
Title: Added methods to support external and embedded CSS style rules

This looks like a relatively large pull request, but the bulk of it is two demo programs to show how the added svg methods work.

Added to svg.go:
* ExternalStyleSheet(), a method to provide an external style sheet file-name for the generated svg
* StartStyle(), StyleRule(), StyleStrings(), StyleEnd(), methods to embed CSS style rules with an SVG style tag.

The style rules are protected from xml interpretation by with a CDATA section

Two demos of using the style methods, based on the original funnel program:
*funnelstyled* demo embeds the CSS style rules.
* styledemos/funnelstyled/funnelstyled.go
* styledemos/funnelstyled/main.go

When run, it is a web server, and prints the URL on stderr

*funnelstylesheet* demo uses an external style sheet, style.css, to provide styles for the svg:
* styledemos/funnelstylesheet/funnelstylesheet.go
* styledemos/funnelstylesheet/main.go
* styledemos/funnelstylesheet/style.css

Again, when run it is a web server, and prints the URL on stderr

When svg.New() was passed "w http.ResponseWriter" within an http.HandlerFunc, the "content-style" of the svg was incorrectly "text/xml". So HttpAdapter (in adapter.go) explicitly sets the "Content-Type" to "image/svg+xml" before calling a top-level function (f func(w io.Writer)) which generates the svg.

Two go source files had execute permission, and so were awkward to edit from a file browser/finder. So those files have had execute permission removed. The content is unchanged.

**Summary**:

Removed execute permission from:
* barchart/barchart.go
* pmap/pmap.go

Modified svg.go to handle external and embedded style

Added two demos for external and embedded style:
* styledemos/funnelstyled/funnelstyled.go
* styledemos/funnelstyled/main.go
* styledemos/funnelstylesheet/funnelstylesheet.go
* styledemos/funnelstylesheet/main.go
* styledemos/funnelstylesheet/style.css

Added adapter.go to make it easier to connect an io.Writer function into the net/http web server