示例#1
0
        public void Issue1_dont_screw_up_the_page_when_using_tables()
        {
            var markdown = @"
            ###Liste des paquets Nuget pour IvFragment Secondaire N3.

            Nom | Version | Descriptions
            --- | ------- | ------------
            N3_IVFragment_Secondaire_MVC5 | 1.2.1 | Utilitaires pour les fragments secondaire

            ###N3 IvFragment Secondaire MVC5

            >Ce paquet Nuget intégrera les fichiers utilitaires requis pour aider à convertir une section d'application .NET MVC en fragment secondaire.
            Quelques modifications seront exécutées dans le fichier de config pour installer le filtre N3 pour le fragment secondaire.

            ![image](https://cloud.githubusercontent.com/assets/10774173/5977134/0b3bfc66-a863-11e4-805b-a55f218f3b41.png)

            The result code is like below; it is missing a th closing tag and merge the rest of the document in the table.
            ";

            var parser = new PageParser(AppDomain.CurrentDomain.BaseDirectory, "");
            var actual = parser.ParseString("", markdown);

            actual.Body.Should().Contain("<h3 id=\"N3IvFragmentSecondaireMVC5\">N3 IvFragment Secondaire MVC5</h3>");
            var posTable = actual.Body.IndexOf("</table>");
            var h3 = actual.Body.IndexOf("<h3 id=\"N3IvFragmentSecondaireMVC5");
            posTable.Should().BeLessThan(h3);
        }
示例#2
0
        public void finds_http_link_correctly()
        {
            var sut = new PageParser(Environment.CurrentDirectory + "\\TestDocs\\", "/intranet/");
            var actual = sut.ParseString("/", @"

            http://this.link

            ");

            actual.Body.Should().Contain(@"href=""http://this.link""");
        }
示例#3
0
        public void headings_should_be_anchored()
        {
            var sut = new PageParser(Environment.CurrentDirectory + "\\TestDocs\\", "/intranet/");
            sut.VirtualPathHandler = OnResolvePath;
            var actual = sut.ParseString("/", @"

            <h1>Parse specific</h1>

            ");

            actual.Body.Should().Contain(@"id=""Parsespecific""");
        }
示例#4
0
        public void finds_unc_path_correctly()
        {
            var sut = new PageParser(Environment.CurrentDirectory + "\\TestDocs\\", "/intranet/");
            sut.VirtualPathHandler = OnResolvePath;
            var actual = sut.ParseString("/", @"

            \\unc_path\to\folder

            ");

            actual.Body.Should().Contain(@"href=""file://\\unc_path\to\folder""");
        }
示例#5
0
        public void finds_www_link_correctly()
        {
            var sut = new PageParser(Environment.CurrentDirectory + "\\TestDocs\\", "/intranet/");
            sut.VirtualPathHandler = OnResolvePath;
            var actual = sut.ParseString("/", @"
            hello world

            this www.onetrueerror.com is a

            link
            ");

            actual.Body.Should().Contain(@"href=""http://www.onetrueerror.com""");
        }
示例#6
0
        public void do_not_destroy_regular_anchor_links()
        {
            var sut = new PageParser(Environment.CurrentDirectory + "\\TestDocs\\", "/intranet/");
            sut.VirtualPathHandler = OnResolvePath;
            var actual = sut.ParseString("/", @"
            hello world

            this <a href=""http://www.onetrueerror.com"">regular</a> is a

            link
            ");

            actual.Body.Should().Contain(@"href=""http://www.onetrueerror.com""");
        }
示例#7
0
        public void markdown_parsing_does_not_destroy_more_complex_tables()
        {
            var sut = new PageParser(Environment.CurrentDirectory + "\\TestDocs\\", "/intranet/");
            sut.VirtualPathHandler = OnResolvePath;
            var actual = sut.ParseString("/", @"

            System         | Alias            | Nod 1            | Nod 2
            ---------------|-------------------|-----------------|-------
            **Winservice**  |  \\blgn165282  |            |
            **Mellanlager** | [AnnoTest](http://AnnoTest)    | \\blgn201086    | \\blgn201087
            **AnnoCache**   |                  | \\blgn201158    | \\blgn201159
            **Databas**	    |  blgn165277     |                   |

            System         | Alias            | Nod 1            | Nod 2
            ---------------|-------------------|-----------------|-------
            **Winservice**  |  \\blgn165282  |            |
            **Mellanlager** | [AnnoTest](http://AnnoTest)    | \\blgn201086    | \\blgn201087
            **AnnoCache**   |                  | \\blgn201158    | \\blgn201159
            **Databas**	    |  blgn165277     |                   |

            ");

            actual.Body.Should().Contain(@"</table>");
        }
示例#8
0
        public void parse_code_blocks()
        {
            var sut = new PageParser(Environment.CurrentDirectory + "\\TestDocs\\", "/intranet/");
            sut.VirtualPathHandler = OnResolvePath;
            var actual = sut.ParseString("/", @"

            ```csharp
            for (int i = 0; i < 10; ++i)
            {
            }
            ```

            ");

            actual.Body.Should().Contain(@"code data-lang=""csharp"" class=""language-csharp""");
        }
示例#9
0
        public void markdown_parsing_does_not_destroy_tables()
        {
            var sut = new PageParser(Environment.CurrentDirectory + "\\TestDocs\\", "/intranet/");
            sut.VirtualPathHandler = OnResolvePath;
            var actual = sut.ParseString("/", @"

            this | is  a | table header
            ----- | ----- | ----------
            *italic* | description | comment
            **bold** | description | comment
            ***italic bold*** | description | comment
            http://autolink.com | yeay | wow

            ");

            actual.Body.Should().Contain(@"</table>");
        }