Fixed ul and ol, now work with formatted text in the list

This commit is contained in:
Cristian Trapattoni 2011-02-25 14:03:14 +01:00
parent bac3de9751
commit 079b3d4df8
2 changed files with 3 additions and 2 deletions

View file

@ -26,12 +26,13 @@ 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))){br}")] [TestCase("<div class=\"box\">text</div>", "(((text))){br}")]
[TestCase("<div>text</div>", "text{br}")] [TestCase("<div>text</div>", "text{br}")]
[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{br}{br}")] [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{br}{br}")]
[TestCase("<ol><li>1</li><li>2</li></ol>", "# 1\r\n# 2\r\n{br}")] [TestCase("<ol><li>1</li><li>2</li></ol>", "# 1\r\n# 2\r\n{br}")]
[TestCase("<ul><li>1</li><li>2</li></ul>", "* 1\r\n* 2\r\n{br}")] [TestCase("<ul><li>1</li><li>2</li></ul>", "* 1\r\n* 2\r\n{br}")]
[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{br}")] [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{br}")]
[TestCase("<ul><li>it 1<ul><li>1.1</li><li>1.2</li></ul></li><li>it2</li></ul>", "* it 1\r\n** 1.1\r\n** 1.2\r\n* it2\r\n{br}")] [TestCase("<ul><li>it 1<ul><li>1.1</li><li>1.2</li></ul></li><li>it2</li></ul>", "* it 1\r\n** 1.1\r\n** 1.2\r\n* it2\r\n{br}")]
[TestCase("<ul><li>it 1<ol><li>1.1</li><li>1.2</li></ol></li><li>it2</li></ul>", "* it 1\r\n*# 1.1\r\n*# 1.2\r\n* it2\r\n{br}")] [TestCase("<ul><li>it 1<ol><li>1.1</li><li>1.2</li></ol></li><li>it2</li></ul>", "* it 1\r\n*# 1.1\r\n*# 1.2\r\n* it2\r\n{br}")]
[TestCase("<ul><li><b>1</b></li><li>2</li></ul>", "* '''1'''\r\n* 2\r\n{br}")]
[TestCase("<html><a id=\"Init\" />I'm an anchor</html>", "[anchor|#init]I'm an anchor")] [TestCase("<html><a id=\"Init\" />I'm an anchor</html>", "[anchor|#init]I'm an anchor")]
[TestCase("<html><a class=\"internallink\" href=\"#init\" title=\"This recall an anchor\">This recall an anchor</a></html>", "[#init|This recall an anchor]")] [TestCase("<html><a class=\"internallink\" href=\"#init\" title=\"This recall an anchor\">This recall an anchor</a></html>", "[#init|This recall an anchor]")]
[TestCase("<html><a class=\"externallink\" href=\"google.com\" title=\"BIG TITLE\" target=\"_blank\">BIG TITLE</a></html>", "[^google.com|BIG TITLE]")] [TestCase("<html><a class=\"externallink\" href=\"google.com\" title=\"BIG TITLE\" target=\"_blank\">BIG TITLE</a></html>", "[^google.com|BIG TITLE]")]

View file

@ -100,7 +100,7 @@ namespace ScrewTurn.Wiki {
result += processList(child.ChildNodes, marker + ul); result += processList(child.ChildNodes, marker + ul);
break; break;
default: default:
StringReader a = new StringReader(child.InnerText); StringReader a = new StringReader(child.OuterXml);
XmlDocument n = FromHTML((TextReader)a); XmlDocument n = FromHTML((TextReader)a);
result += marker + " " + processChild(n.ChildNodes) + "\r\n"; result += marker + " " + processChild(n.ChildNodes) + "\r\n";
break; break;