From 1f1afc99e86f17fcd8a0397fbc007eb9f61f6344 Mon Sep 17 00:00:00 2001 From: Daniel Barber Date: Sun, 17 Nov 2019 23:00:38 -0500 Subject: [PATCH] Remove double backslashes This must be a bug in Kramdown. --- lib/micropub/post.rb | 8 +++++--- test/lib/micropub/post_test.rb | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/micropub/post.rb b/lib/micropub/post.rb index 6e0b6f3..e141249 100644 --- a/lib/micropub/post.rb +++ b/lib/micropub/post.rb @@ -63,8 +63,10 @@ module Micropub params["content"]["text"] elsif params["content"]["html"] Kramdown::Document. - new(params["content"]["html"], html_to_native: true). - to_kramdown + new(params["content"]["html"], input: "html"). + to_kramdown. + gsub("\\", "") + # TODO: Look into possible Kramdown bug end end @@ -82,7 +84,7 @@ module Micropub #{post_frontmatter.strip} --- - #{content} + #{content.strip} POST end end diff --git a/test/lib/micropub/post_test.rb b/test/lib/micropub/post_test.rb index 8d8f8b4..f77e67f 100644 --- a/test/lib/micropub/post_test.rb +++ b/test/lib/micropub/post_test.rb @@ -170,11 +170,11 @@ describe Micropub::Post do _(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 + > 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 + > 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 + > programs. Some don't, become nothing. She starred in one of the ones > that became nothing. * One