public void Parse_StrongEmphasis()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"not strong **//strong em//** not strong not em **//strong em**// just em");

			Assert.AreEqual(@"<p>not strong <strong><em>strong em</em></strong> not strong not em <strong><em>strong em</em></strong><em> just em</em></p>", actual);
		}
		public void Parse_EmphasisUrls()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"Creole1.0 specifies that http://bar and ftp://bar should not render italic, something like foo://bar should render as italic.");

			Assert.AreEqual(@"<p>Creole1.0 specifies that http://bar and ftp://bar should not render italic, something like foo:<em>bar should render as italic.</em></p>", actual);
		}
		public void Parse_Strong()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"not strong **strong ** not strong **strong");

			Assert.AreEqual(@"<p>not strong <strong>strong </strong> not strong <strong>strong</strong></p>", actual);
		}
		public void Parse_Emphasis()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"not em //em // not em //em");

			Assert.AreEqual(@"<p>not em <em>em </em> not em <em>em</em></p>", actual);
		}
		public void Parse_EmphasisLink()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"//test [[http://www.google.com]] test//");
			
			Assert.AreEqual(@"<p><em>test <a href=""http://www.google.com"" target=""_blank"">http://www.google.com</a> test</em></p>", actual);
		}
		public void Parse_LineBreak()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"first line\\second line
\\third line

another paragraph");

			Assert.AreEqual(@"<p>first line<br />
second line
<br />
third line</p>
<p>another paragraph</p>", actual);
		}
		public void Parse_Paragraphs()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"paragraph 1

paragraph 2
still paragraph 2

paragraph 3");

			Assert.AreEqual(@"<p>paragraph 1</p>
<p>paragraph 2
still paragraph 2</p>
<p>paragraph 3</p>", actual);
		}
		public void Parse_ResolveLink()
		{
			var parser = new CreoleParser();

			parser.LinkResolver = l => "/test/" + l.Replace(" ", "-");

			var actual = parser.Parse(@"[[mighty link]]");

			Assert.AreEqual(@"<p><a href=""/test/mighty-link"">mighty link</a></p>", actual);
		}
		public void Parse_Table_WithEmptyCell()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"|cell 1|**bold cell 2**
|  | cell 2 row 2 | //cell 3 row 2//");

			Assert.AreEqual(@"<table>
    <tr>
        <td>cell 1</td>
        <td><strong>bold cell 2</strong></td>
    </tr>
    <tr>
        <td></td>
        <td>cell 2 row 2</td>
        <td><em>cell 3 row 2</em></td>
    </tr>
</table>", actual);
		}
Exemplo n.º 10
0
		public void Parse_Heading_WithPartialEnding()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"====== h6 ===");

			Assert.AreEqual(@"<h6> h6 </h6>", actual);
		}
Exemplo n.º 11
0
		public void Parse_Table_WithHeader_WithEndings()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"|= Header 1 |= Header 2 |
|cell 1|**bold cell 2**|
| cell 1 row 2 | cell 2 row 2 | //cell 3 row 2//");

			Assert.AreEqual(@"<table>
    <thead>
        <tr>
            <th>Header 1</th>
            <th>Header 2</th>
        </tr>
    <thead>
    <tr>
        <td>cell 1</td>
        <td><strong>bold cell 2</strong></td>
    </tr>
    <tr>
        <td>cell 1 row 2</td>
        <td>cell 2 row 2</td>
        <td><em>cell 3 row 2</em></td>
    </tr>
</table>", actual);
		}
Exemplo n.º 12
0
		public void Parse_Heading_WithAdditions()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"===== h5 ======");

			Assert.AreEqual(@"<h5> h5 =</h5>", actual);
		}
Exemplo n.º 13
0
		public void Parse_List_WithMixing()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"# list 1
## list 2
## list 2
*** list 3
*** list 3
*#*** list 1
**** list 2
** list 2
## list 2
# list 1");

			Assert.AreEqual(@"<ol>
    <li>list 1
        <ol>
            <li>list 2</li>
            <li>list 2
                <ul>
                    <li>list 3</li>
                    <li>list 3</li>
                </ul>
            </li>
        </ol>
    </li>
</ol>
<ul>
    <li>#<strong>* list 1</strong>
        <ul>
            <li><strong> list 2</strong></li>
            <li>list 2</li>
        </ul>
        <ol>
            <li>list 2</li>
        </ol>
    </li>
</ul>
<ol>
    <li>list 1</li>
</ol>", actual);
		}
Exemplo n.º 14
0
		public void Parse_List_WithNesting()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"# list 1
## list 2
## list 2
#### list 3
# list 1");

			Assert.AreEqual(@"<ol>
    <li>list 1
        <ol>
            <li>list 2</li>
            <li>list 2
                <ol>
                    <li># list 3</li>
                </ol>
            </li>
        </ol>
    </li>
    <li>list 1</li>
</ol>", actual);
		}
Exemplo n.º 15
0
        public static string wikiText_Transform(this string wikiText)
        {
            if(wikiText.notValid())
                return "";
            try
            {
                wikiText = wikiText.wikiCreole_Fix_WikiText_Bullets();
                var html  = "";
                var wikiParseThread = O2Thread.mtaThread(()=>
                    {
                        html = new CreoleParser().Parse(wikiText)
                                                 .wikiCreole_Replaced_Html_Code_Tag_with_Pre();
                    });
                if(wikiParseThread.Join(MAX_RENDER_WAIT))
                    if(html.valid())
                        return html;

                "[CreoleWiki_ExtensionMethods][wikiText_Transform] failed for WikiText: \n\n{0}\n\n".error(wikiText);
                wikiParseThread.Abort();
            }
            catch(Exception ex)
            {
                ex.log("[wikiText_transform]");
            }
            return "<b>TEAM Mentor Error:</b><br/><br/> Sorry it was not possible to render this article. Please contact <a href=\"mailto:[email protected]\">Security Innovation Support</a>.";
        }
Exemplo n.º 16
0
		public void Parse_ResolveImage()
		{
			var parser = new CreoleParser();

			parser.ImageResolver = l => "/images/" + l.Replace(" ", "-");

			var actual = parser.Parse(@"{{mighty image}}");

			Assert.AreEqual(@"<p><img src=""/images/mighty-image"" alt="""" /></p>", actual);
		}
Exemplo n.º 17
0
		public void Parse_Link_Free()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse("http://www.google.com");

			Assert.AreEqual(@"<p><a href=""http://www.google.com"" target=""_blank"">http://www.google.com</a></p>", actual);

			actual = parser.Parse("http:/www.google.com");

			Assert.AreEqual(@"<p>http:/www.google.com</p>", actual);
		}
Exemplo n.º 18
0
		public void Parse_Link_ExternalWithTitle()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse("[[http://www.google.com|Uncle google]]");

			Assert.AreEqual(@"<p><a href=""http://www.google.com"" target=""_blank"">Uncle google</a></p>", actual);
		}
Exemplo n.º 19
0
		public void Parse_Link_WithTitle()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse("[[test page|test page title]]");

			Assert.AreEqual(@"<p><a href=""test%20page"">test page title</a></p>", actual);
		}
Exemplo n.º 20
0
		public void Parse_HorizontalLine()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"first paragraph
 ----- 
second paragraph
---- still second paragraph");

			Assert.AreEqual(@"<p>first paragraph</p>
<hr />
<p>second paragraph
---- still second paragraph</p>", actual);
		}
Exemplo n.º 21
0
		public void Parse_Heading_WithManyAdditions()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"======== h6 ========");

			Assert.AreEqual(@"<h6>== h6 ==</h6>", actual);
		}
Exemplo n.º 22
0
		public void Parse_Image()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse("{{/content/images/test.png}}");

			Assert.AreEqual(@"<p><img src=""/content/images/test.png"" alt="""" /></p>", actual);
		}
Exemplo n.º 23
0
		public void Parse_Heading()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"= h1");

			Assert.AreEqual(@"<h1> h1</h1>", actual);
		}
Exemplo n.º 24
0
		public void Parse_Image_WithTitleQuotes()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse("{{/content/images/test.png|title'\"}}");

			Assert.AreEqual(@"<p><img src=""/content/images/test.png"" alt=""title&#39;&quot;"" /></p>", actual);
		}
Exemplo n.º 25
0
		public void Parse_List()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"# list 1
# list 2
* list 1
* list 2");

			Assert.AreEqual(@"<ol>
    <li>list 1</li>
    <li>list 2</li>
</ol>
<ul>
    <li>list 1</li>
    <li>list 2</li>
</ul>", actual);
		}
Exemplo n.º 26
0
		public void Parse_NoWiki()
		{
			var parser = new CreoleParser();

			var actual = parser.Parse(@"test here

{{{
**no wiki here**
}}}

**but wiki here**");

			Assert.AreEqual(@"<p>test here</p>
<pre>
**no wiki here**
</pre>
<p><strong>but wiki here</strong></p>", actual);
		}
Exemplo n.º 27
0
        public ActionResult Wiki(string markup = "")
        {
			var html = new CreoleParser().Parse(markup);

            return Json(html, JsonRequestBehavior.AllowGet);
        }