@@ 29,11 29,11 @@ end
local document = P{
"document",
document = Ct((V"doctype" * V"html" ^ 0) + (V"html" ^ 1)) / table.concat,
- html = V"comment" + V"void_element" + V"self_closing" + V"pre" + V"start_tag" + V"close_tag" + V"whitespace" + V"text_node",
+ html = V"comment" + V"void_element" + V"self_closing" + V"pre" + V"start_tag" + V"close_tag" + V"text_node" + V"whitespace",
pre = Ct(V"start_pre" * C(1 - V"close_pre") ^ 0 * V"close_pre") / unpack,
start_pre = Ct(C(P"<") * C(any_case"pre") * (V"whitespace" * V"modifiers") ^ -1 * V"optional_space" * C(P">")) / unpack,
close_pre = Ct(C(P"</") * C(any_case"pre") * V"optional_space" * C(P">")) / unpack,
- text_node = C(P(1 - (space ^ 2 + V"comment" + V"start_tag" + V"close_tag" + V"void_element")) ^ 1),
+ text_node = C(P(1 - (S"\r\n" + space ^ 2 + V"comment" + V"start_tag" + V"close_tag" + V"void_element")) ^ 1),
start_tag = Ct(C(P"<") * V"optional_space" * C(V"tag_name") * (V"whitespace" * V"modifiers") ^ -1 * V"optional_space" * C(P">")) / unpack,
close_tag = Ct(C(P"</") * V"optional_space" * C(V"tag_name") * V"optional_space" * C(P">")) / unpack,
self_closing = Ct(C(P"<") * C(V"tag_name") * (V"whitespace" * V"modifiers") ^ -1 * V"optional_space" * P"/>") / unpack,