simple-html-tokenizer icon indicating copy to clipboard operation
simple-html-tokenizer copied to clipboard

how to rebuild the html string

Open purple-force opened this issue 5 years ago • 6 comments

When i got data by tokenize , how to rebuild the html string?

purple-force avatar May 15 '19 09:05 purple-force

I don't understand the question, can you explain what you are trying to do?

rwjblue avatar May 16 '19 17:05 rwjblue

I can get the structural data from html string by tokenize, then how to generate html string by structural data?

purple-force avatar May 17 '19 08:05 purple-force

@rwjblue I think the question was more about how to construct HTML string from parsed tokens. And this https://github.com/tildeio/simple-html-tokenizer/blob/v0.1.1/lib/simple-html-tokenizer/generator.js#L27 looks exactly what @purple-force needs.

Baltazore avatar Jun 24 '20 10:06 Baltazore

Do we have generators in latest version?

Baltazore avatar Jun 24 '20 10:06 Baltazore

No, it was removed in https://github.com/tildeio/simple-html-tokenizer/commit/01479fe883cee3ead68079ec0f576cdcfc1e96fd

rwjblue avatar Jun 24 '20 14:06 rwjblue

hey @rwjblue thanks for answer. Any particular reason to remove this part? I am right now trying to use this tokenizer to parse and modify given HTML snippet. Am I doing it wrong (wrong tool to use) or it is still valid idea, and I just need to implement generator of HTML from tokens tree on my own?

Baltazore avatar Jun 25 '20 11:06 Baltazore