Fixed ul and ol with annidation

This commit is contained in:
Cristian Trapattoni 2011-02-25 12:15:29 +01:00
parent 6528094b1b
commit bac3de9751
2 changed files with 50 additions and 36 deletions

View file

@ -90,13 +90,22 @@ namespace ScrewTurn.Wiki {
string ul = "*";
string ol = "#";
foreach(XmlNode node in nodes) {
foreach(XmlNode child in node) {
if(child.Name.ToString() == "ol")
result += marker + " " +processList(child.ChildNodes, marker + ol);
if(child.Name.ToString() == "ul")
result += marker + " "+ processList(child.ChildNodes, marker + ul);
else
result += processChild(child.ChildNodes);
if(node.Name.ToString() == "li"){
foreach(XmlNode child in node.ChildNodes) {
switch(child.Name.ToString()){
case "ol":
result += processList(child.ChildNodes, marker + ol);
break;
case "ul":
result += processList(child.ChildNodes, marker + ul);
break;
default:
StringReader a = new StringReader(child.InnerText);
XmlDocument n = FromHTML((TextReader)a);
result += marker + " " + processChild(n.ChildNodes) + "\r\n";
break;
}
}
}
}
return result;
@ -174,6 +183,9 @@ namespace ScrewTurn.Wiki {
}
else {
switch(node.Name.ToLowerInvariant()) {
case "html":
result += processChild(node.ChildNodes);
break;
case "b":
case "strong":
result += ("'''" + processChild(node.ChildNodes) + "'''");