Answer the question
In order to leave comments, you need to log in
How to parse lexemes for html template engine?
I have a lexer class which is from text, for example:
%div.content
%h1.headline Заголовок
[
{
lexem: 'tag',
value: { name: 'div', content: '', attributes: [Object] }
},
{ lexem: 'indent', value: ' ' },
{
lexem: 'tag',
value: { name: 'h1', content: 'Заголовок', attributes: [Object] }
}
]
{
type: "root",
nodes: [
{
type: "tag",
value: {
name: "div",
attributes: {
class: "content"
},
nodes: [ // вместо content, я пишу nodes (узлы), в которых будут лежать дочерние тэги
{
// и тут дочерние тэги, а в дочерних тэгах, могут быть еще тэги
}
]
}
}
]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question