mirror of
https://github.com/danbee/micropub.git
synced 2025-03-04 08:59:13 +00:00
Accepts HTML and converts to markdown
This commit is contained in:
parent
bcd2180438
commit
5f25e4b4c0
@ -142,6 +142,46 @@ describe Post do
|
|||||||
|
|
||||||
_(post.content.strip).must_equal "Hello, World!"
|
_(post.content.strip).must_equal "Hello, World!"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "converts complex HTML content to Markdown" do
|
||||||
|
post = Post.new(
|
||||||
|
"content" => {
|
||||||
|
"html" => <<~HTML,
|
||||||
|
<p>This is a test post, with some lists and stuff.</p>
|
||||||
|
|
||||||
|
<blockquote>
|
||||||
|
Well, the way they make shows is, they make one show. That show's
|
||||||
|
called a pilot. Then they show that show to the people who make
|
||||||
|
shows, and on the strength of that one show they decide if they're
|
||||||
|
going to make more shows. Some pilots get picked and become
|
||||||
|
television programs. Some don't, become nothing. She starred in
|
||||||
|
one of the ones that became nothing.
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>One</li>
|
||||||
|
<li>Two</li>
|
||||||
|
<li>Three</li>
|
||||||
|
</ul>
|
||||||
|
HTML
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
_(post.content.strip).must_equal <<~MARKDOWN.strip
|
||||||
|
This is a test post, with some lists and stuff.
|
||||||
|
|
||||||
|
> Well, the way they make shows is, they make one show. That show\\'s
|
||||||
|
> called a pilot. Then they show that show to the people who make shows,
|
||||||
|
> and on the strength of that one show they decide if they\\'re going to
|
||||||
|
> make more shows. Some pilots get picked and become television
|
||||||
|
> programs. Some don\\'t, become nothing. She starred in one of the ones
|
||||||
|
> that became nothing.
|
||||||
|
|
||||||
|
* One
|
||||||
|
* Two
|
||||||
|
* Three
|
||||||
|
MARKDOWN
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#post_content" do
|
describe "#post_content" do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user