https://developer.mozilla.org/en-US/docs/Web/SVG/Element#Text_content_elements
<text> elements can contain quite a number of children that allow you to do very precise formatting of the actual text content. There are plenty of usecases like custom fonts, rendering text on a path, text effects, etc. However having the thing that inserts a text node called text when there exists also a text element is confusing. Also text nodes are much rarer in practice in SVG than in HTML, so using a longer function name would make sense. I think textNode : String -> Svg msg would make sense and make text : List (Attribute msg) -> List (Svg msg) -> Svg msg would make sense. On Monday, 17 April 2017 16:07:44 UTC+1, Duane Johnson wrote: > > > On Mon, Apr 17, 2017 at 4:49 AM, 'Rupert Smith' via Elm Discuss < > [email protected] <javascript:>> wrote: > >> Not much progress with this recently, sorry. But starting to look at it >> again today and I am back to work this week. I'm just trying to render some >> simple diagrams with boxes and text and arrows and such-like. >> > > Great! > > >> >> The way you put text in a diagram is a bit strange, as you use >> "TypedSvg.text_" to render the <text> node but then "TypedSvg.Core.text" to >> insert the actual text. So that is how SVG works but I think perhaps a >> helper function could make it nicer. >> > > Yeah, I think that's reasonable. Would it make sense to have: > > `text : List (Attribute msg) -> String -> Svg msg` > a helper method that takes attributes and a string, and returns a text > node with text > > `textNode : List (Attribute msg) -> List (Svg msg) -> Svg msg` > what is now "text_" > > `textContent : String -> Svg msg` > what is now "text" > > The reason I think it makes sense to use the more-desirable "text" method > as the helper itself is because I can't think of a use case where you'd > want to add anything other than one piece of text content inside a text > node. And if there is such a use case, it seems obscure. So that makes me > want to make the short and concise function the one that is most useful, > and the more verbose ones used in rare cases. > > Duane > > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
