05_markdown.tests.rb

来自「用ruby on rails写的一个博客程序,还不错..ruby on rail」· RB 代码 · 共 1,528 行 · 第 1/3 页

RB
1,528
字号
--- Should become:<p>The left angle-bracket (<code>&amp;lt;</code>) can also be written as a decimal-encoded(<code>&amp;#060;</code>) or hex-encoded (<code>&amp;#x3c;</code>) entity.</p>>>># At the beginning of a document (Bug #525)<<<`world` views--- Should become:<p><code>world</code> views</p>>>>### [Code blocks]# Para plus code block (literal tab)<<<This is a chunk of code:	some.code > some.other_codeSome stuff.--- Should become:<p>This is a chunk of code:</p><pre><code>some.code &gt; some.other_code</code></pre><p>Some stuff.</p>>>># Para plus code block (literal tab, no colon)<<<This is a chunk of code	some.code > some.other_codeSome stuff.--- Should become:<p>This is a chunk of code</p><pre><code>some.code &gt; some.other_code</code></pre><p>Some stuff.</p>>>># Para plus code block (tab-width spaces)<<<This is a chunk of code:    some.code > some.other_codeSome stuff.--- Should become:<p>This is a chunk of code:</p><pre><code>some.code &gt; some.other_code</code></pre><p>Some stuff.</p>>>># Para plus code block (tab-width spaces, no colon)<<<This is a chunk of code    some.code > some.other_codeSome stuff.--- Should become:<p>This is a chunk of code</p><pre><code>some.code &gt; some.other_code</code></pre><p>Some stuff.</p>>>># Colon with preceeding space<<<A regular paragraph, without a colon. :    This is a code block.Some stuff.--- Should become:<p>A regular paragraph, without a colon. :</p><pre><code>This is a code block.</code></pre><p>Some stuff.</p>>>># Single colon<<<:		some.code > some.other_codeSome stuff.--- Should become:<p>:</p><pre><code>some.code &gt; some.other_code</code></pre><p>Some stuff.</p>>>># Preserve leading whitespace (Bug #541)<<<Examples:          # (Waste character because first line is flush left !!!)          # Example script1          x = 1          x += 1          puts xSome stuff.--- Should become:<p>Examples:</p><pre><code>      # (Waste character because first line is flush left !!!)      # Example script1      x = 1      x += 1      puts x</code></pre><p>Some stuff.</p>>>>### [Horizontal Rules]# Hrule 1<<<* * *--- Should become:<hr/>>>># Hrule 2<<<***--- Should become:<hr/>>>># Hrule 3<<<*****--- Should become:<hr/>>>># Hrule 4<<<- - ---- Should become:<hr/>>>># Hrule 5<<<------------------------------------------ Should become:<hr/>>>>### [Titles]# setext-style h1<<<Title Text=--- Should become:<h1>Title Text</h1>>>><<<Title Text===--- Should become:<h1>Title Text</h1>>>><<<Title Text==========--- Should become:<h1>Title Text</h1>>>># setext-style h2<<<Title Text---- Should become:<h2>Title Text</h2>>>><<<Title Text------ Should become:<h2>Title Text</h2>>>><<<Title Text------------- Should become:<h2>Title Text</h2>>>># ATX-style h1<<<# Title Text--- Should become:<h1>Title Text</h1>>>><<<# Title Text #--- Should become:<h1>Title Text</h1>>>><<<# Title Text ###--- Should become:<h1>Title Text</h1>>>><<<# Title Text #####--- Should become:<h1>Title Text</h1>>>># ATX-style h2<<<## Title Text--- Should become:<h2>Title Text</h2>>>><<<## Title Text #--- Should become:<h2>Title Text</h2>>>><<<## Title Text ###--- Should become:<h2>Title Text</h2>>>><<<## Title Text #####--- Should become:<h2>Title Text</h2>>>># ATX-style h3<<<### Title Text--- Should become:<h3>Title Text</h3>>>><<<### Title Text #--- Should become:<h3>Title Text</h3>>>><<<### Title Text ###--- Should become:<h3>Title Text</h3>>>><<<### Title Text #####--- Should become:<h3>Title Text</h3>>>># ATX-style h4<<<#### Title Text--- Should become:<h4>Title Text</h4>>>><<<#### Title Text #--- Should become:<h4>Title Text</h4>>>><<<#### Title Text ###--- Should become:<h4>Title Text</h4>>>><<<#### Title Text #####--- Should become:<h4>Title Text</h4>>>># ATX-style h5<<<##### Title Text--- Should become:<h5>Title Text</h5>>>><<<##### Title Text #--- Should become:<h5>Title Text</h5>>>><<<##### Title Text ###--- Should become:<h5>Title Text</h5>>>><<<##### Title Text #####--- Should become:<h5>Title Text</h5>>>># ATX-style h6<<<###### Title Text--- Should become:<h6>Title Text</h6>>>><<<###### Title Text #--- Should become:<h6>Title Text</h6>>>><<<###### Title Text ###--- Should become:<h6>Title Text</h6>>>><<<###### Title Text #####--- Should become:<h6>Title Text</h6>>>>### [Blockquotes]# Regular 1-level blockquotes<<<> Email-style angle brackets> are used for blockquotes.--- Should become:<blockquote>    <p>Email-style angle brackets    are used for blockquotes.</p></blockquote>>>># Doubled blockquotes<<<> > And, they can be nested.--- Should become:<blockquote>    <blockquote>        <p>And, they can be nested.</p>    </blockquote></blockquote>>>># Nested blockquotes<<<> Email-style angle brackets> are used for blockquotes.> > And, they can be nested.--- Should become:<blockquote>    <p>Email-style angle brackets    are used for blockquotes.</p>        <blockquote>        <p>And, they can be nested.</p>    </blockquote></blockquote>>>># Lazy blockquotes<<<> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisseid sem consectetuer libero luctus adipiscing.--- Should become:<blockquote>    <p>This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,    consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.    Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.</p>        <p>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse    id sem consectetuer libero luctus adipiscing.</p></blockquote>>>># Blockquotes containing other markdown elements<<<> ## This is a header.> > 1.   This is the first list item.> 2.   This is the second list item.> > Here's some example code:> >     return shell_exec("echo $input | $markdown_script");--- Should become:<blockquote>    <h2>This is a header.</h2>        <ol>    <li>This is the first list item.</li>    <li>This is the second list item.</li>    </ol>        <p>Here's some example code:</p><pre><code>return shell_exec("echo $input | $markdown_script");</code></pre></blockquote>>>># Blockquotes with a <pre> section<<<> The best approximation of the problem is the following code:>> <pre>> foo + bar; foo.factorize; foo.display> </pre>> > This should result in an error on any little-endian platform.--- Should become:<blockquote>    <p>The best approximation of the problem is the following code:</p><pre>foo + bar; foo.factorize; foo.display</pre>        <p>This should result in an error on any little-endian platform.</p></blockquote>>>>### [Images]# Inline image with title<<<![alt text](/path/img.jpg "Title")--- Should become:<p><img src="/path/img.jpg" alt="alt text" title="Title"/></p>>>># Inline image with title (single-quotes)<<<![alt text](/path/img.jpg 'Title')--- Should become:<p><img src="/path/img.jpg" alt="alt text" title="Title"/></p>>>># Inline image with title (with embedded quotes)<<<![alt text](/path/img.jpg 'The "Title" Image')--- Should become:<p><img src="/path/img.jpg" alt="alt text" title="The &quot;Title&quot; Image"/></p>>>># Inline image without title<<<![alt text](/path/img.jpg)--- Should become:

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?