mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
Add formatter class and associated unit tests
This commit is contained in:
parent
2b008f7be6
commit
ed50a57f9c
31 changed files with 692 additions and 0 deletions
6
tests/_data/formatter/bbcode.source.txt
Normal file
6
tests/_data/formatter/bbcode.source.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
This is the first paragraph.
|
||||
It contains [b]bold[/b] [i]italic[/i] text.
|
||||
|
||||
[quote]This is quoted text.[/quote]
|
||||
|
||||
This example belongs to the test suite for [url="https://www.rhymix.org"]Rhymix[/url].
|
||||
6
tests/_data/formatter/bbcode.target.html
Normal file
6
tests/_data/formatter/bbcode.target.html
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
This is the first paragraph.
|
||||
It contains <strong>bold</strong> <em>italic</em> text.
|
||||
|
||||
<blockquote>This is quoted text.</blockquote>
|
||||
|
||||
This example belongs to the test suite for <a href="https://www.rhymix.org">Rhymix</a>.
|
||||
13
tests/_data/formatter/html2markdown.source.html
Normal file
13
tests/_data/formatter/html2markdown.source.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<p>This is a Markdown document.
|
||||
These lines belong in the same paragraph.
|
||||
Markdown usually ignores single line breaks.
|
||||
</p>
|
||||
|
||||
<p>This is a <a href="foobar.html" title="title">link</a>.<br />
|
||||
This is an <img src="foobar.jpg" title="image" alt="alt" />.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>This is a list.</li>
|
||||
<li>It has two items.</li>
|
||||
</ul>
|
||||
7
tests/_data/formatter/html2markdown.target.md
Normal file
7
tests/_data/formatter/html2markdown.target.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
This is a Markdown document. These lines belong in the same paragraph. Markdown usually ignores single line breaks.
|
||||
|
||||
This is a [link](foobar.html "title").
|
||||
This is an .
|
||||
|
||||
- This is a list.
|
||||
- It has two items.
|
||||
13
tests/_data/formatter/html2text.source.html
Normal file
13
tests/_data/formatter/html2text.source.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<p>
|
||||
This is a sample text file.<br />
|
||||
This is a paragraph with multiple lines.<br />
|
||||
This is the third line.
|
||||
</p>
|
||||
<p>
|
||||
This is another paragraph.
|
||||
</p>
|
||||
<p>
|
||||
This is a <span>SPAN</span> element that will be stripped away.<br />
|
||||
This is a <a href="foobar.html">link</a> that will be preserved.<br />
|
||||
This is an <img src="test.jpg" alt="Image Title" /> that will be preserved.<br />
|
||||
</p>
|
||||
9
tests/_data/formatter/html2text.target.txt
Normal file
9
tests/_data/formatter/html2text.target.txt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
This is a sample text file.
|
||||
This is a paragraph with multiple lines.
|
||||
This is the third line.
|
||||
|
||||
This is another paragraph.
|
||||
|
||||
This is a SPAN element that will be stripped away.
|
||||
This is a link <foobar.html> that will be preserved.
|
||||
This is an [Image Title] <test.jpg> that will be preserved.
|
||||
3
tests/_data/formatter/less.source1.less
Normal file
3
tests/_data/formatter/less.source1.less
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.myfunction(@size) {
|
||||
margin: @size;
|
||||
}
|
||||
7
tests/_data/formatter/less.source2.less
Normal file
7
tests/_data/formatter/less.source2.less
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
.rhymix {
|
||||
color: @foo;
|
||||
background: url('foo/bar.jpg');
|
||||
span {
|
||||
.myfunction(@bar);
|
||||
}
|
||||
}
|
||||
9
tests/_data/formatter/less.target1.css
Normal file
9
tests/_data/formatter/less.target1.css
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
@charset "UTF-8";
|
||||
.rhymix {
|
||||
color: #123456;
|
||||
background: url("../_data/formatter/foo/bar.jpg");
|
||||
}
|
||||
.rhymix span {
|
||||
margin: 320px;
|
||||
}
|
||||
|
||||
2
tests/_data/formatter/less.target2.css
Normal file
2
tests/_data/formatter/less.target2.css
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
@charset "UTF-8";
|
||||
.rhymix{color:#123456;background:url("../_data/formatter/foo/bar.jpg");}.rhymix span{margin:320px;}
|
||||
17
tests/_data/formatter/markdown2html.source.md
Normal file
17
tests/_data/formatter/markdown2html.source.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
This is a Markdown document.
|
||||
These lines belong in the same paragraph.
|
||||
Markdown usually ignores single line breaks.
|
||||
|
||||
This is an indented code segment.
|
||||
All Markdown variants will recognize it.
|
||||
|
||||
```
|
||||
This is a fenced code segment.
|
||||
Only Markdown Extra will recognize it.
|
||||
```
|
||||
|
||||
This is a [link](foobar.html).
|
||||
This is an .
|
||||
|
||||
- This is a list.
|
||||
- It has two items.
|
||||
17
tests/_data/formatter/markdown2html.target1.html
Normal file
17
tests/_data/formatter/markdown2html.target1.html
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<p>This is a Markdown document.
|
||||
These lines belong in the same paragraph.
|
||||
Markdown usually ignores single line breaks.</p>
|
||||
|
||||
<pre><code>This is an indented code segment.
|
||||
All Markdown variants will recognize it.
|
||||
</code></pre>
|
||||
|
||||
<p><code>This is a fenced code segment.
|
||||
Only Markdown Extra will recognize it.</code></p>
|
||||
|
||||
<p>This is a <a href="foobar.html">link</a>.
|
||||
This is an <img src="foobar.jpg" alt="image" />.</p>
|
||||
|
||||
<ul><li>This is a list.</li>
|
||||
<li>It has two items.</li>
|
||||
</ul>
|
||||
17
tests/_data/formatter/markdown2html.target2.html
Normal file
17
tests/_data/formatter/markdown2html.target2.html
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<p>This is a Markdown document.<br />
|
||||
These lines belong in the same paragraph.<br />
|
||||
Markdown usually ignores single line breaks.</p>
|
||||
|
||||
<pre><code>This is an indented code segment.
|
||||
All Markdown variants will recognize it.
|
||||
</code></pre>
|
||||
|
||||
<p><code>This is a fenced code segment.
|
||||
Only Markdown Extra will recognize it.</code></p>
|
||||
|
||||
<p>This is a <a href="foobar.html">link</a>.<br />
|
||||
This is an <img src="foobar.jpg" alt="image" />.</p>
|
||||
|
||||
<ul><li>This is a list. </li>
|
||||
<li>It has two items. </li>
|
||||
</ul>
|
||||
18
tests/_data/formatter/markdown2html.target3.html
Normal file
18
tests/_data/formatter/markdown2html.target3.html
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<p>This is a Markdown document.<br />
|
||||
These lines belong in the same paragraph.<br />
|
||||
Markdown usually ignores single line breaks.</p>
|
||||
|
||||
<pre><code>This is an indented code segment.
|
||||
All Markdown variants will recognize it.
|
||||
</code></pre>
|
||||
|
||||
<pre><code>This is a fenced code segment.
|
||||
Only Markdown Extra will recognize it.
|
||||
</code></pre>
|
||||
|
||||
<p>This is a <a href="foobar.html">link</a>.<br />
|
||||
This is an <img src="foobar.jpg" alt="image" />.</p>
|
||||
|
||||
<ul><li>This is a list. </li>
|
||||
<li>It has two items. </li>
|
||||
</ul>
|
||||
10
tests/_data/formatter/minify.source.css
Normal file
10
tests/_data/formatter/minify.source.css
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
@charset "UTF-8";
|
||||
.rhymix {
|
||||
background: url("foo/bar.jpg");
|
||||
}
|
||||
.wordpress {
|
||||
border-radius: 4px;
|
||||
}
|
||||
.xpressengine {
|
||||
margin: 320px;
|
||||
}
|
||||
6
tests/_data/formatter/minify.source.js
Normal file
6
tests/_data/formatter/minify.source.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(function($) {
|
||||
$(".foo").click(function(event) {
|
||||
event.preventDefault();
|
||||
$(this).attr("bar", "baz");
|
||||
});
|
||||
})(jQuery);
|
||||
1
tests/_data/formatter/minify.target.css
Normal file
1
tests/_data/formatter/minify.target.css
Normal file
|
|
@ -0,0 +1 @@
|
|||
@charset "UTF-8";.rhymix{background:url(../_data/formatter/foo/bar.jpg)}.wordpress{border-radius:4px}.xpressengine{margin:320px}
|
||||
1
tests/_data/formatter/minify.target.js
Normal file
1
tests/_data/formatter/minify.target.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
(function($){$(".foo").click(function(event){event.preventDefault();$(this).attr("bar","baz")})})(jQuery)
|
||||
3
tests/_data/formatter/scss.source1.scss
Normal file
3
tests/_data/formatter/scss.source1.scss
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
@mixin mymixin($size) {
|
||||
margin: $size;
|
||||
}
|
||||
7
tests/_data/formatter/scss.source2.scss
Normal file
7
tests/_data/formatter/scss.source2.scss
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
.rhymix {
|
||||
color: $foo;
|
||||
background: url('foo/bar.jpg');
|
||||
span {
|
||||
@include mymixin($bar);
|
||||
}
|
||||
}
|
||||
9
tests/_data/formatter/scss.target1.css
Normal file
9
tests/_data/formatter/scss.target1.css
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
@charset "UTF-8";
|
||||
.rhymix {
|
||||
color: #123456;
|
||||
background: url("../_data/formatter/foo/bar.jpg");
|
||||
}
|
||||
.rhymix span {
|
||||
margin: 320px;
|
||||
}
|
||||
|
||||
2
tests/_data/formatter/scss.target2.css
Normal file
2
tests/_data/formatter/scss.target2.css
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
@charset "UTF-8";
|
||||
.rhymix{color:#123456;background:url("../_data/formatter/foo/bar.jpg")}.rhymix span{margin:320px}
|
||||
2
tests/_data/formatter/smartypants.source.html
Normal file
2
tests/_data/formatter/smartypants.source.html
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<p>This paragraph contains "dumb quotes" and short -- dashes.</p>
|
||||
<p>This paragraph contains ``backtick quotes'' and 'long' --- dashes...</p>
|
||||
2
tests/_data/formatter/smartypants.target.html
Normal file
2
tests/_data/formatter/smartypants.target.html
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<p>This paragraph contains “dumb quotes” and short — dashes.</p>
|
||||
<p>This paragraph contains “backtick quotes” and ’long’ – dashes…</p>
|
||||
9
tests/_data/formatter/text2html.source.txt
Normal file
9
tests/_data/formatter/text2html.source.txt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
This is a sample text file.
|
||||
Some of these lines are close together.
|
||||
|
||||
Other lines are separated by two newlines.
|
||||
|
||||
|
||||
Or three newlines.
|
||||
This is a <p>tag</p> that will be escaped if encoded.
|
||||
Hello world!
|
||||
9
tests/_data/formatter/text2html.target1.html
Normal file
9
tests/_data/formatter/text2html.target1.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
This is a sample text file.<br />
|
||||
Some of these lines are close together.<br />
|
||||
<br />
|
||||
Other lines are separated by two newlines.<br />
|
||||
<br />
|
||||
<br />
|
||||
Or three newlines.<br />
|
||||
This is a <p>tag</p> that will be escaped if encoded.<br />
|
||||
Hello world!<br />
|
||||
9
tests/_data/formatter/text2html.target2.html
Normal file
9
tests/_data/formatter/text2html.target2.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<p>This is a sample text file.</p>
|
||||
<p>Some of these lines are close together.</p>
|
||||
<p></p>
|
||||
<p>Other lines are separated by two newlines.</p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p>Or three newlines.</p>
|
||||
<p>This is a <p>tag</p> that will be escaped if encoded.</p>
|
||||
<p>Hello world!</p>
|
||||
12
tests/_data/formatter/text2html.target3.html
Normal file
12
tests/_data/formatter/text2html.target3.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<p>
|
||||
This is a sample text file.<br />
|
||||
Some of these lines are close together.
|
||||
</p>
|
||||
<p>
|
||||
Other lines are separated by two newlines.
|
||||
</p>
|
||||
<p>
|
||||
Or three newlines.<br />
|
||||
This is a <p>tag</p> that will be escaped if encoded.<br />
|
||||
Hello world!
|
||||
</p>
|
||||
Loading…
Add table
Add a link
Reference in a new issue