Can the composite pattern be used to generate HTML from a tree and handle the indenting as well, or this inherently not possible?
6
I watched this video on the composite pattern, where the main example is how to use the pattern as a mean to generate HTML code from a tree structure describing a todo list where each item can be in turn a todo list, and it seems a convenient test-bed, so here it is a target HTML: [ ] Main <ul> <li>[ ] 1.</li> <li>[ ] 2. <ul> <li>[ ] 2.1</li> <li>[ ] 2.2</li> </ul> </li> <li>[ ] 3.</li> </ul> (Sorry if the top [ ] Main doesn't make sense, but I don't know HTML; furthermore that's irrelevant to my question, I believe.) I understand that design patterns are mostly an OOP "thing", however I'm often referring to the article Design P...