1+ // All output is buffered into the object SVG, then written to the output stream.
12package goat
23
34import (
@@ -21,24 +22,24 @@ svg {
2122 color: %s;
2223}
2324@media (prefers-color-scheme: dark) {
24- svg {
25- color: %s;
26- }
25+ svg {
26+ color: %s;
27+ }
2728}
2829</style>` ,
2930 svgColorLightScheme ,
3031 svgColorDarkScheme )
3132
3233 return fmt .Sprintf (
33- "<svg class='%s' xmlns='%s' version='%s' height='%d' width='%d' font-family='Menlo,Lucida Console,monospace'>\n " +
34+ "<svg xmlns='%s' version='%s' height='%d' width='%d' font-family='Menlo,Lucida Console,monospace'>\n " +
3435 "%s\n " +
3536 "%s</svg>\n " ,
36- "diagram" , // XX can this have any effect?
3737 "http://www.w3.org/2000/svg" ,
3838 "1.1" , s .Height , s .Width , style , s .Body )
3939}
4040
41- // BuildSVG reads in a newline-delimited ASCII diagram from src and returns an SVG.
41+ // BuildSVG reads a newline-delimited ASCII diagram from src and returns an
42+ // initialized SVG struct.
4243func BuildSVG (src io.Reader ) SVG {
4344 var buff bytes.Buffer
4445 canvas := NewCanvas (src )
@@ -53,7 +54,7 @@ func BuildSVG(src io.Reader) SVG {
5354// BuildAndWriteSVG reads in a newline-delimited ASCII diagram from src and writes a
5455// corresponding SVG diagram to dst.
5556func BuildAndWriteSVG (src io.Reader , dst io.Writer ,
56- svgColorLightScheme string , svgColorDarkScheme string ) {
57+ svgColorLightScheme , svgColorDarkScheme string ) {
5758 svg := BuildSVG (src )
5859 writeBytes (dst , svg .String (svgColorLightScheme , svgColorDarkScheme ))
5960}
@@ -70,12 +71,12 @@ func writeBytes(out io.Writer, format string, args ...interface{}) {
7071func writeText (out io.Writer , canvas * Canvas ) {
7172 writeBytes (out ,
7273 `<style>
73- text {
74+ text {
7475 text-anchor: middle;
7576 font-family: "Menlo","Lucida Console","monospace";
7677 fill: currentColor;
7778 font-size: 1em;
78- }
79+ }
7980</style>
8081` )
8182 for _ , textObj := range canvas .Text () {
0 commit comments