Изменения

Перейти к навигации Перейти к поиску
list, comment
Строка 63: Строка 63:  
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
 
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
 
'p', 'div', 'br', 'hr', 'img',
 
'p', 'div', 'br', 'hr', 'img',
 +
'ol', 'ul', 'li', 'dl', 'dt', 'dd',
 
'table', 'thead', 'tbody', 'tfoot', 'tr', 'th', 'td'
 
'table', 'thead', 'tbody', 'tfoot', 'tr', 'th', 'td'
 
}
 
}
   −
-- Table tags are unmergeable:
+
-- Table amd list tags are unmergeable:
local table_set = to_set { 'table', 'thead', 'tbody', 'tfoot', 'tr', 'th', 'td' }
+
local unmergeable = to_set {
 +
'table', 'thead', 'tbody', 'tfoot', 'tr', 'th', 'td',
 +
'ol', 'ul', 'li', 'dl', 'dt', 'dd'
 +
}
    
-- Return true, if node1 and node2 are tags ot the same type with exactly the same attributes:
 
-- Return true, if node1 and node2 are tags ot the same type with exactly the same attributes:
Строка 74: Строка 78:  
return false
 
return false
 
end
 
end
if table_set [node1.__name] or table_set [node2.__name] then
+
if unmergeable [node1.__name] or unmergeable [node2.__name] then
 
-- Table elements should not be merged:
 
-- Table elements should not be merged:
 
return false
 
return false
Строка 143: Строка 147:  
end
 
end
 
local child = node [1]
 
local child = node [1]
if not child or type (child) == 'string' or table_set [child.__name] then
+
if not child or type (child) == 'string' or unmergeable [child.__name] then
 
return node
 
return node
 
end
 
end
Строка 170: Строка 174:     
local grammar = P { Ct (V'fragment') * -1,
 
local grammar = P { Ct (V'fragment') * -1,
fragment = (V'tag' + C (V'char' ^ 1)) ^ 0,
+
fragment = (V'comment' + V'tag' + C (V'char' ^ 1)) ^ 0,
 
tag = Ct (V'open' * V'fragment' * V'close' + V'void') / function (tbl)
 
tag = Ct (V'open' * V'fragment' * V'close' + V'void') / function (tbl)
 
if tear [tbl.__name] then
 
if tear [tbl.__name] then
Строка 214: Строка 218:  
quoted = quoted'"' + quoted"'",
 
quoted = quoted'"' + quoted"'",
 
unquoted = Cg ((any - space - equals - gt) ^ 1, 'value'),
 
unquoted = Cg ((any - space - equals - gt) ^ 1, 'value'),
char = -lt * any
+
char = -lt * any,
 +
comment = P'<!--' * (any - '-->') ^ 0 * '-->'
 
}
 
}
 
 

Реклама:

Навигация