Don't render image heights explicitly
The CSS itself will take care of scaling the image height based on the width. We still need to know the height to fetch the image because the height is in the URL, but we don't need to render it in the HTML.
This commit is contained in:
parent
bf43c7f467
commit
5c05086cbd
2 changed files with 5 additions and 5 deletions
|
@ -90,7 +90,7 @@ describe PageContent do
|
|||
it "renders a figure and figure caption" do
|
||||
page = Page.new(nodes: [
|
||||
Figure.new(children: [
|
||||
Image.new(src: "image.png", originalWidth: 100, originalHeight: 100),
|
||||
Image.new(src: "image.png", originalWidth: 100, originalHeight: 200),
|
||||
FigureCaption.new(children: [
|
||||
Text.new("A caption"),
|
||||
] of Child),
|
||||
|
@ -101,7 +101,7 @@ describe PageContent do
|
|||
|
||||
html.should eq stripped_html <<-HTML
|
||||
<figure>
|
||||
<img src="https://cdn-images-1.medium.com/fit/c/100/100/image.png" width="100" height="100">
|
||||
<img src="https://cdn-images-1.medium.com/fit/c/100/200/image.png" width="100">
|
||||
<figcaption>A caption</figcaption>
|
||||
</figure>
|
||||
HTML
|
||||
|
@ -134,7 +134,7 @@ describe PageContent do
|
|||
it "renders an image" do
|
||||
page = Page.new(nodes: [
|
||||
Paragraph.new(children: [
|
||||
Image.new(src: "image.png", originalWidth: 100, originalHeight: 100),
|
||||
Image.new(src: "image.png", originalWidth: 100, originalHeight: 200),
|
||||
] of Child),
|
||||
] of Child)
|
||||
|
||||
|
@ -142,7 +142,7 @@ describe PageContent do
|
|||
|
||||
html.should eq stripped_html <<-HTML
|
||||
<p>
|
||||
<img src="https://cdn-images-1.medium.com/fit/c/100/100/image.png" width="100" height="100">
|
||||
<img src="https://cdn-images-1.medium.com/fit/c/100/200/image.png" width="100">
|
||||
</p>
|
||||
HTML
|
||||
end
|
||||
|
|
|
@ -63,7 +63,7 @@ class PageContent < BaseComponent
|
|||
end
|
||||
|
||||
def render_child(child : Image)
|
||||
img src: child.src, width: child.width, height: child.height
|
||||
img src: child.src, width: child.width
|
||||
end
|
||||
|
||||
def render_child(node : ListItem)
|
||||
|
|
Loading…
Reference in a new issue