Fixed bug on image in IE

Fixed bug {BR}
This commit is contained in:
Cristian Trapattoni 2011-02-25 18:15:55 +01:00
parent 002096b2ff
commit d68793daba
2 changed files with 5 additions and 6 deletions

View file

@ -26,7 +26,7 @@ namespace ScrewTurn.Wiki.Tests {
[TestCase("<code><b>text</b></code>", "{{'''text'''}}")] [TestCase("<code><b>text</b></code>", "{{'''text'''}}")]
[TestCase("<div class=\"box\">text</div>", "(((text)))\r\n")] [TestCase("<div class=\"box\">text</div>", "(((text)))\r\n")]
[TestCase("<div>text</div>", "text\r\n")] [TestCase("<div>text</div>", "text\r\n")]
[TestCase("<html><ol><li>1</li><li>2</li><li>3<ol><li>3.1</li><li>3.2<ol><li>3.2.1</li></ol></li><li>3.3</li></ol></li><li>4<br /></li></ol><br /></html>", "# 1\r\n# 2\r\n# 3\r\n## 3.1\r\n## 3.2\r\n### 3.2.1\r\n## 3.3\r\n# 4\r\n# \r\n\r\n\r\n\r\n")] [TestCase("<html><ol><li>1</li><li>2</li><li>3<ol><li>3.1</li><li>3.2<ol><li>3.2.1</li></ol></li><li>3.3</li></ol></li><li>4<br /></li></ol><br /></html>", "# 1\r\n# 2\r\n# 3\r\n## 3.1\r\n## 3.2\r\n### 3.2.1\r\n## 3.3\r\n# 4\r\n# {BR}\r\n\r\n\r\n{BR}\r\n")]
[TestCase("<ol><li>1</li><li>2</li></ol>", "# 1\r\n# 2\r\n\r\n")] [TestCase("<ol><li>1</li><li>2</li></ol>", "# 1\r\n# 2\r\n\r\n")]
[TestCase("<ul><li>1</li><li>2</li></ul>", "* 1\r\n* 2\r\n\r\n")] [TestCase("<ul><li>1</li><li>2</li></ul>", "* 1\r\n* 2\r\n\r\n")]
[TestCase("<html><ul><li>Punto 1</li><li>Punto 2</li><li>Punto 3</li><li>Punto 4</li><li>Punto 5</li></ul></html>", "* Punto 1\r\n* Punto 2\r\n* Punto 3\r\n* Punto 4\r\n* Punto 5\r\n\r\n")] [TestCase("<html><ul><li>Punto 1</li><li>Punto 2</li><li>Punto 3</li><li>Punto 4</li><li>Punto 5</li></ul></html>", "* Punto 1\r\n* Punto 2\r\n* Punto 3\r\n* Punto 4\r\n* Punto 5\r\n\r\n")]

View file

@ -57,7 +57,7 @@ namespace ScrewTurn.Wiki {
string result = ""; string result = "";
if(node.Attributes.Count != 0) { if(node.Attributes.Count != 0) {
foreach(XmlAttribute attName in node.Attributes) { foreach(XmlAttribute attName in node.Attributes) {
if(attName.Name.ToString() == "src") { if((attName.Name.ToString() == "src") || (attName.Value.ToString().ToLowerInvariant() == "Image")) {
string[] path = attName.Value.ToString().Split('='); string[] path = attName.Value.ToString().Split('=');
result += "{" + "UP(" + path[1].Split('&')[0] + ")}" + path[2]; result += "{" + "UP(" + path[1].Split('&')[0] + ")}" + path[2];
} }
@ -114,9 +114,8 @@ namespace ScrewTurn.Wiki {
bool anchor = false; bool anchor = false;
if(node.NodeType == XmlNodeType.Text) { if(node.NodeType == XmlNodeType.Text) {
result += node.Value; result += node.Value;
//string result = "";
} }
else { else if (node.NodeType != XmlNodeType.Whitespace){
switch(node.Name.ToLowerInvariant()) { switch(node.Name.ToLowerInvariant()) {
case "html": case "html":
result += processChild(node.ChildNodes); result += processChild(node.ChildNodes);
@ -176,9 +175,8 @@ namespace ScrewTurn.Wiki {
} }
} }
break; break;
case "\n":
case "br": case "br":
result += ("\r\n" + processChild(node.ChildNodes)); result += ("{BR}\r\n" + processChild(node.ChildNodes));
break; break;
case "table": case "table":
string image = ""; string image = "";
@ -227,6 +225,7 @@ namespace ScrewTurn.Wiki {
result += ""; result += "";
} }
} }
else result += processChild(node.ChildNodes) + "{BR}\r\n";
break; break;
case "div": case "div":
if(node.Attributes.Count != 0) { if(node.Attributes.Count != 0) {