From bf43c7f46720e550e8dfbd543c849868245cbde5 Mon Sep 17 00:00:00 2001 From: Edward Loveall Date: Sun, 8 Aug 2021 18:17:46 -0400 Subject: [PATCH] Add PQ (pullquote) type This appears for something like medium's "top highlight". It's like a blockquote but bigger --- spec/classes/paragraph_converter_spec.cr | 12 +++++++++++- src/classes/paragraph_converter.cr | 4 ++++ src/models/post_response.cr | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/spec/classes/paragraph_converter_spec.cr b/spec/classes/paragraph_converter_spec.cr index 45ea604..67f1046 100644 --- a/spec/classes/paragraph_converter_spec.cr +++ b/spec/classes/paragraph_converter_spec.cr @@ -244,6 +244,15 @@ describe ParagraphConverter do "layout": null, "metadata": null }, + { + "text": "text", + "type": "PQ", + "markups": [], + "href": null, + "iframe": null, + "layout": null, + "metadata": null + }, { "text": "text", "type": "ULI", @@ -295,7 +304,8 @@ describe ParagraphConverter do Heading4.new([Text.new("text")] of Child), Paragraph.new([Text.new("text")] of Child), Preformatted.new([Text.new("text")] of Child), - BlockQuote.new([Text.new("text")] of Child), + BlockQuote.new([Text.new("text")] of Child), # BQ + BlockQuote.new([Text.new("text")] of Child), # PQ UnorderedList.new([ListItem.new([Text.new("text")] of Child)] of Child), OrderedList.new([ListItem.new([Text.new("text")] of Child)] of Child), Figure.new(children: [ diff --git a/src/classes/paragraph_converter.cr b/src/classes/paragraph_converter.cr index 8c6d7f9..e21343a 100644 --- a/src/classes/paragraph_converter.cr +++ b/src/classes/paragraph_converter.cr @@ -35,6 +35,10 @@ class ParagraphConverter paragraph = paragraphs.shift children = MarkupConverter.convert(paragraph.text, paragraph.markups) node = Paragraph.new(children: children) + when PostResponse::ParagraphType::PQ + paragraph = paragraphs.shift + children = MarkupConverter.convert(paragraph.text, paragraph.markups) + node = BlockQuote.new(children: children) when PostResponse::ParagraphType::PRE paragraph = paragraphs.shift children = MarkupConverter.convert(paragraph.text, paragraph.markups) diff --git a/src/models/post_response.cr b/src/models/post_response.cr index d006ebd..51506cf 100644 --- a/src/models/post_response.cr +++ b/src/models/post_response.cr @@ -47,6 +47,7 @@ class PostResponse IMG OLI P + PQ PRE ULI end