crystal tool format
This commit is contained in:
parent
210f212116
commit
130b235a6c
5 changed files with 18 additions and 18 deletions
|
@ -126,7 +126,7 @@ describe MarkupConverter do
|
||||||
|
|
||||||
result.should eq([
|
result.should eq([
|
||||||
Text.new("I am a "),
|
Text.new("I am a "),
|
||||||
Anchor.new(text: "Link", href: "https://example.com")
|
Anchor.new(text: "Link", href: "https://example.com"),
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ describe ParagraphConverter do
|
||||||
Paragraph.new(children: [
|
Paragraph.new(children: [
|
||||||
Text.new(content: "inline "),
|
Text.new(content: "inline "),
|
||||||
Code.new(children: [Text.new(content: "code")] of Child),
|
Code.new(children: [Text.new(content: "code")] of Child),
|
||||||
] of Child)
|
] of Child),
|
||||||
]
|
]
|
||||||
|
|
||||||
result = ParagraphConverter.new.convert(paragraphs)
|
result = ParagraphConverter.new.convert(paragraphs)
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe PageContent do
|
||||||
page = Page.new(nodes: [
|
page = Page.new(nodes: [
|
||||||
Paragraph.new(children: [
|
Paragraph.new(children: [
|
||||||
Text.new(content: "hi"),
|
Text.new(content: "hi"),
|
||||||
] of Child)
|
] of Child),
|
||||||
] of Child)
|
] of Child)
|
||||||
|
|
||||||
html = PageContent.new(page: page).render_to_string
|
html = PageContent.new(page: page).render_to_string
|
||||||
|
@ -20,17 +20,17 @@ describe PageContent do
|
||||||
Paragraph.new(children: [
|
Paragraph.new(children: [
|
||||||
Text.new(content: "Hello, "),
|
Text.new(content: "Hello, "),
|
||||||
Emphasis.new(children: [
|
Emphasis.new(children: [
|
||||||
Text.new(content: "World!")
|
Text.new(content: "World!"),
|
||||||
] of Child)
|
] of Child),
|
||||||
] of Child),
|
] of Child),
|
||||||
UnorderedList.new(children: [
|
UnorderedList.new(children: [
|
||||||
ListItem.new(children: [
|
ListItem.new(children: [
|
||||||
Text.new(content: "List!")
|
Text.new(content: "List!"),
|
||||||
] of Child),
|
] of Child),
|
||||||
ListItem.new(children: [
|
ListItem.new(children: [
|
||||||
Text.new(content: "Again!"),
|
Text.new(content: "Again!"),
|
||||||
] of Child)
|
] of Child),
|
||||||
] of Child)
|
] of Child),
|
||||||
] of Child)
|
] of Child)
|
||||||
|
|
||||||
html = PageContent.new(page: page).render_to_string
|
html = PageContent.new(page: page).render_to_string
|
||||||
|
@ -51,8 +51,8 @@ describe PageContent do
|
||||||
it "renders a blockquote" do
|
it "renders a blockquote" do
|
||||||
page = Page.new(nodes: [
|
page = Page.new(nodes: [
|
||||||
BlockQuote.new(children: [
|
BlockQuote.new(children: [
|
||||||
Text.new("Wayne Gretzky. Michael Scott.")
|
Text.new("Wayne Gretzky. Michael Scott."),
|
||||||
] of Child)
|
] of Child),
|
||||||
] of Child)
|
] of Child)
|
||||||
|
|
||||||
html = PageContent.new(page: page).render_to_string
|
html = PageContent.new(page: page).render_to_string
|
||||||
|
@ -63,8 +63,8 @@ describe PageContent do
|
||||||
it "renders code" do
|
it "renders code" do
|
||||||
page = Page.new(nodes: [
|
page = Page.new(nodes: [
|
||||||
Code.new(children: [
|
Code.new(children: [
|
||||||
Text.new("foo = bar")
|
Text.new("foo = bar"),
|
||||||
] of Child)
|
] of Child),
|
||||||
] of Child)
|
] of Child)
|
||||||
|
|
||||||
html = PageContent.new(page: page).render_to_string
|
html = PageContent.new(page: page).render_to_string
|
||||||
|
@ -77,7 +77,7 @@ describe PageContent do
|
||||||
Paragraph.new(children: [
|
Paragraph.new(children: [
|
||||||
Text.new(content: "This is "),
|
Text.new(content: "This is "),
|
||||||
Emphasis.new(children: [
|
Emphasis.new(children: [
|
||||||
Text.new(content: "neat!")
|
Text.new(content: "neat!"),
|
||||||
] of Child),
|
] of Child),
|
||||||
] of Child),
|
] of Child),
|
||||||
] of Child)
|
] of Child)
|
||||||
|
@ -92,7 +92,7 @@ describe PageContent do
|
||||||
Figure.new(children: [
|
Figure.new(children: [
|
||||||
Image.new(src: "image.png", originalWidth: 100, originalHeight: 100),
|
Image.new(src: "image.png", originalWidth: 100, originalHeight: 100),
|
||||||
FigureCaption.new(children: [
|
FigureCaption.new(children: [
|
||||||
Text.new("A caption")
|
Text.new("A caption"),
|
||||||
] of Child),
|
] of Child),
|
||||||
] of Child),
|
] of Child),
|
||||||
] of Child)
|
] of Child)
|
||||||
|
@ -135,7 +135,7 @@ describe PageContent do
|
||||||
page = Page.new(nodes: [
|
page = Page.new(nodes: [
|
||||||
Paragraph.new(children: [
|
Paragraph.new(children: [
|
||||||
Image.new(src: "image.png", originalWidth: 100, originalHeight: 100),
|
Image.new(src: "image.png", originalWidth: 100, originalHeight: 100),
|
||||||
] of Child)
|
] of Child),
|
||||||
] of Child)
|
] of Child)
|
||||||
|
|
||||||
html = PageContent.new(page: page).render_to_string
|
html = PageContent.new(page: page).render_to_string
|
||||||
|
@ -151,7 +151,7 @@ describe PageContent do
|
||||||
page = Page.new(nodes: [
|
page = Page.new(nodes: [
|
||||||
Paragraph.new(children: [
|
Paragraph.new(children: [
|
||||||
IFrame.new(href: "https://example.com"),
|
IFrame.new(href: "https://example.com"),
|
||||||
] of Child)
|
] of Child),
|
||||||
] of Child)
|
] of Child)
|
||||||
|
|
||||||
html = PageContent.new(page: page).render_to_string
|
html = PageContent.new(page: page).render_to_string
|
||||||
|
|
|
@ -82,7 +82,7 @@ class ParagraphConverter
|
||||||
originalWidth: metadata.originalWidth,
|
originalWidth: metadata.originalWidth,
|
||||||
originalHeight: metadata.originalHeight
|
originalHeight: metadata.originalHeight
|
||||||
),
|
),
|
||||||
FigureCaption.new(children: caption_markup)
|
FigureCaption.new(children: caption_markup),
|
||||||
] of Child)
|
] of Child)
|
||||||
else
|
else
|
||||||
Empty.new
|
Empty.new
|
||||||
|
|
|
@ -80,7 +80,7 @@ module Nodes
|
||||||
|
|
||||||
class Image
|
class Image
|
||||||
IMAGE_HOST = "https://cdn-images-1.medium.com/fit/c"
|
IMAGE_HOST = "https://cdn-images-1.medium.com/fit/c"
|
||||||
MAX_WIDTH = 800
|
MAX_WIDTH = 800
|
||||||
|
|
||||||
getter originalHeight : Int32
|
getter originalHeight : Int32
|
||||||
getter originalWidth : Int32
|
getter originalWidth : Int32
|
||||||
|
|
Loading…
Reference in a new issue