Skip to content

Instantly share code, notes, and snippets.

@h-hirai
Created February 1, 2010 15:23
Show Gist options
  • Save h-hirai/291745 to your computer and use it in GitHub Desktop.
Save h-hirai/291745 to your computer and use it in GitHub Desktop.
data XMLItem = XMLElem String [(String, String)] [XMLItem]
| Text String
attrsShow as = concat [" " ++ k ++ "=\"" ++ v ++ "\"" | (k, v) <- as]
instance Show XMLItem where
show (Text s) = s
show (XMLElem tag as []) = "<" ++ tag ++ attrsShow as ++ " />"
show (XMLElem tag as cs) = "<" ++ tag ++ attrsShow as ++ ">" ++
concatMap show cs ++
"</" ++ tag ++ ">"
arrowHead = XMLElem "defs" [] [
XMLElem "marker" [("id","Triangle"),
("viewBox","0 0 10 10"),
("refX","0"),
("refX","5"),
("markerUnits","strokeWidth"),
("markerWidth","4"),
("markerHeight","3"),
("orient","auto")] [
XMLElem "path" [("d", "M 0 0 L 10 5 L 0 10 z")] []
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment