A
A
Aleksey Pleshkov2017-06-17 19:33:39
Swift
Aleksey Pleshkov, 2017-06-17 19:33:39

How to properly implement scopes to generate html code?

Good day. I am writing a training project for training / developing skills in Swift.
The essence of the project is the generation of html code from swift.
Link to main.swift
Link to HtmlBuilder.swift
The problem is that the tags are not quite added to the "exhaust" this way. Looking at the structure in main.swift and the exhaust itself (below)

<body id='test2'>
<p id='test2'>
<tagname>wow test custom tag</tagname>
<a class='link-button' href='http://www.site.ru'>click me</a>
</p>
</body>

It becomes clear that "tagname" is assigned to the body of "p", which should not be. The problem is in these lines: Here .
I can't think of the logic for proper tag nesting.
I hope for help, for several days I can not find a solution. Code with comments.
Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question