Added some tests and fixed extra <br>
This commit is contained in:
parent
fc13759baf
commit
39ec1e3dc0
2 changed files with 7 additions and 5 deletions
|
@ -18,6 +18,7 @@ namespace ScrewTurn.Wiki.Tests {
|
|||
[TestCase("<u>text</u>", "__text__")]
|
||||
[TestCase("<s>text</s>", "--text--")]
|
||||
[TestCase("<html><table border=\"1\" bgcolor=\"LightBlue\"><thead><tr><th>Cells x.1</th><th>Cells x.2</th></tr></thead><tbody><tr><td>Cell 1.1</td><td>Cell 1.2</td></tr><tr><td>Cell 2.1</td><td>Cell 2.2</td></tr></tbody></table></html>", "{| border=\"1\" bgcolor=\"LightBlue\" \r\n|- \r\n! Cells x.1\r\n! Cells x.2\r\n|- \r\n| Cell 1.1\r\n| Cell 1.2\r\n|- \r\n| Cell 2.1\r\n| Cell 2.2\r\n|}\r\n")]
|
||||
[TestCase("<ol><li><a class=\"internallink\" target=\"_blank\" href=\"www.try.com\" title=\"try\">try</a></li><li><a class=\"internallink\" target=\"_blank\" href=\"www.secondtry.com\" title=\"www.secondtry.com\">www.secondtry.com</a><br></li></ol>","# [^www.try.com|try]\r\n# [^www.secondtry.com|www.secondtry.com]\r\n")]
|
||||
[TestCase("<table><tbody><tr><td bgcolor=\"Blue\">Styled Cell</td><td>Normal cell</td></tr><tr><td>Normal cell</td><td bgcolor=\"Yellow\">Styled cell</td></tr></tbody></table>", "{| \r\n|- \r\n| bgcolor=\"Blue\" | Styled Cell\r\n| Normal cell\r\n|- \r\n| Normal cell\r\n| bgcolor=\"Yellow\" | Styled cell\r\n|}\r\n")]
|
||||
[TestCase("<h1>text</h1>", "\r\n==text==\r\n")]
|
||||
[TestCase("<h2>text</h2>", "\r\n===text===\r\n")]
|
||||
|
@ -32,8 +33,9 @@ namespace ScrewTurn.Wiki.Tests {
|
|||
[TestCase("<html>riga1\r\n<b>riga2</b>\r\nriga3</html>", "riga1\r\n'''riga2'''\r\nriga3")]
|
||||
[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 ciao</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 ciao\r\n\r\n")]
|
||||
[TestCase("<ol><li>1</li><li>2</li></ol>", "# 1\r\n# 2\r\n")]
|
||||
[TestCase("<ul><li><img src=\"GetFile.aspx?File=/AmanuensMicro.png\" alt=\"Image\"></li><li><div class=\"imageleft\"><img class=\"image\" src=\"GetFile.aspx?File=/DownloadButton.png\" alt=\"Image\"></div></li><li><div class=\"imageright\"><a target=\"_blank\" href=\"www.tututu.tu\" title=\"guihojk\"><img class=\"image\" src=\"GetFile.aspx?File=/Checked.png\" alt=\"guihojk\"></a><p class=\"imagedescription\">guihojk</p></div></li><li><table class=\"imageauto\" cellpadding=\"0\" cellspacing=\"0\"><tbody><tr><td><img class=\"image\" src=\"GetFile.aspx?File=/Alert.png\" alt=\"auto\"><p class=\"imagedescription\">auto</p></td></tr></tbody></table><br></li></ul>", "* [image|Image|{UP}/AmanuensMicro.png]\r\n* [imageleft||{UP}/DownloadButton.png]\r\n* [imageright|guihojk|{UP}/Checked.png|^www.tututu.tu]\r\n* [imageauto|auto|{UP}/Alert.png]\r\n\r\n")]
|
||||
[TestCase("<ul><li>1</li><li>2</li></ul>", "* 1\r\n* 2\r\n")]
|
||||
[TestCase("<div class=\"imageright\"><img class=\"image\" src=\"GetFile.aspx?File=/Help/Desktop/image.png\"><p class=\"imagedescription\">description</p></div>", "\r\n[imageright|description|{UP}/Help/Desktop/image.png]\r\n")]
|
||||
[TestCase("<div class=\"imageright\"><img class=\"image\" src=\"GetFile.aspx?File=/Help/Desktop/image.png\"><p class=\"imagedescription\">description</p></div>", "[imageright|description|{UP}/Help/Desktop/image.png]\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")]
|
||||
[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")]
|
||||
[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")]
|
||||
|
@ -42,7 +44,7 @@ namespace ScrewTurn.Wiki.Tests {
|
|||
[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("<esc>try to esc tag</esc>", "<esc>try to esc tag</esc>")]
|
||||
[TestCase("<div class=\"imageleft\"><a target=\"_blank\" href=\"www.link.com\" title=\"left Align\"><img class=\"image\" src=\"GetFile.aspx?Page=MainPage&File=image.png\" alt=\"left Align\" /></a><p class=\"imagedescription\">leftalign</p></div>", "\r\n[imageleft|leftalign|{UP(MainPage)}image.png|^www.link.com]\r\n")]
|
||||
[TestCase("<div class=\"imageleft\"><a target=\"_blank\" href=\"www.link.com\" title=\"left Align\"><img class=\"image\" src=\"GetFile.aspx?Page=MainPage&File=image.png\" alt=\"left Align\" /></a><p class=\"imagedescription\">leftalign</p></div>", "[imageleft|leftalign|{UP(MainPage)}image.png|^www.link.com]\r\n")]
|
||||
[TestCase("<img src=\"GetFile.aspx?Page=MainPage&File=image.png\" alt=\"inlineimage\" />", "[image|inlineimage|{UP(MainPage)}image.png]\r\n")]
|
||||
[TestCase("<a target=\"_blank\" href=\"www.google.it\" title=\"description\"><img src=\"GetFile.aspx?Page=MainPage&File=image.png\" alt=\"description\" /></a>", "[image|description|{UP(MainPage)}image.png|^www.google.it]\r\n")]
|
||||
[TestCase("<table class=\"imageauto\" cellpadding=\"0\" cellspacing=\"0\"><tbody><tr><td><img class=\"image\" src=\"GetFile.aspx?Page=MainPage&File=image.png\" alt=\"autoalign\" /><p class=\"imagedescription\">autoalign</p></td></tr></tbody></table>", "[imageauto|autoalign|{UP(MainPage)}image.png]\r\n")]
|
||||
|
|
|
@ -351,12 +351,12 @@ namespace ScrewTurn.Wiki {
|
|||
result += "\r\n" + "(((" + processChild(node.ChildNodes) + ")))\r\n";
|
||||
}
|
||||
if(attName.Value.ToString() == "imageleft") {
|
||||
result += "\r\n" + "[imageleft" + processChildImage(node.ChildNodes) + "]\r\n";
|
||||
result += "[imageleft" + processChildImage(node.ChildNodes) + "]\r\n";
|
||||
}
|
||||
if(attName.Value.ToString() == "imageright")
|
||||
result += "\r\n" + "[imageright" + processChildImage(node.ChildNodes) + "]\r\n";
|
||||
result += "[imageright" + processChildImage(node.ChildNodes) + "]\r\n";
|
||||
if(attName.Value.ToString() == "image")
|
||||
result += "\r\n" + "[image" + processChildImage(node.ChildNodes) + "]\r\n";
|
||||
result += "[image" + processChildImage(node.ChildNodes) + "]\r\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue