Use H2/H3 instead of H3/H4 respectively
General CSS hygiene dictates that you shouldn't go beyond an H3 tag. H1 for the document title, H2 for section headings, and H3 for low-level headings.
This commit is contained in:
parent
5c05086cbd
commit
f48f7c2932
5 changed files with 13 additions and 13 deletions
|
@ -300,8 +300,8 @@ describe ParagraphConverter do
|
||||||
]
|
]
|
||||||
JSON
|
JSON
|
||||||
expected = [
|
expected = [
|
||||||
|
Heading2.new([Text.new("text")] of Child),
|
||||||
Heading3.new([Text.new("text")] of Child),
|
Heading3.new([Text.new("text")] of Child),
|
||||||
Heading4.new([Text.new("text")] of Child),
|
|
||||||
Paragraph.new([Text.new("text")] of Child),
|
Paragraph.new([Text.new("text")] of Child),
|
||||||
Preformatted.new([Text.new("text")] of Child),
|
Preformatted.new([Text.new("text")] of Child),
|
||||||
BlockQuote.new([Text.new("text")] of Child), # BQ
|
BlockQuote.new([Text.new("text")] of Child), # BQ
|
||||||
|
|
|
@ -109,26 +109,26 @@ describe PageContent do
|
||||||
|
|
||||||
it "renders an H3" do
|
it "renders an H3" do
|
||||||
page = Page.new(nodes: [
|
page = Page.new(nodes: [
|
||||||
Heading3.new(children: [
|
Heading2.new(children: [
|
||||||
Text.new(content: "Title!"),
|
Text.new(content: "Title!"),
|
||||||
] of Child),
|
] of Child),
|
||||||
] of Child)
|
] of Child)
|
||||||
|
|
||||||
html = PageContent.new(page: page).render_to_string
|
html = PageContent.new(page: page).render_to_string
|
||||||
|
|
||||||
html.should eq %(<h3>Title!</h3>)
|
html.should eq %(<h2>Title!</h2>)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "renders an H4" do
|
it "renders an H4" do
|
||||||
page = Page.new(nodes: [
|
page = Page.new(nodes: [
|
||||||
Heading4.new(children: [
|
Heading3.new(children: [
|
||||||
Text.new(content: "In Conclusion..."),
|
Text.new(content: "In Conclusion..."),
|
||||||
] of Child),
|
] of Child),
|
||||||
] of Child)
|
] of Child)
|
||||||
|
|
||||||
html = PageContent.new(page: page).render_to_string
|
html = PageContent.new(page: page).render_to_string
|
||||||
|
|
||||||
html.should eq %(<h4>In Conclusion...</h4>)
|
html.should eq %(<h3>In Conclusion...</h3>)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "renders an image" do
|
it "renders an image" do
|
||||||
|
|
|
@ -13,11 +13,11 @@ class ParagraphConverter
|
||||||
when PostResponse::ParagraphType::H3
|
when PostResponse::ParagraphType::H3
|
||||||
paragraph = paragraphs.shift
|
paragraph = paragraphs.shift
|
||||||
children = MarkupConverter.convert(paragraph.text, paragraph.markups)
|
children = MarkupConverter.convert(paragraph.text, paragraph.markups)
|
||||||
node = Heading3.new(children: children)
|
node = Heading2.new(children: children)
|
||||||
when PostResponse::ParagraphType::H4
|
when PostResponse::ParagraphType::H4
|
||||||
paragraph = paragraphs.shift
|
paragraph = paragraphs.shift
|
||||||
children = MarkupConverter.convert(paragraph.text, paragraph.markups)
|
children = MarkupConverter.convert(paragraph.text, paragraph.markups)
|
||||||
node = Heading4.new(children: children)
|
node = Heading3.new(children: children)
|
||||||
when PostResponse::ParagraphType::IFRAME
|
when PostResponse::ParagraphType::IFRAME
|
||||||
paragraph = paragraphs.shift
|
paragraph = paragraphs.shift
|
||||||
if iframe = paragraph.iframe
|
if iframe = paragraph.iframe
|
||||||
|
|
|
@ -46,12 +46,12 @@ class PageContent < BaseComponent
|
||||||
figcaption { render_children(node.children) }
|
figcaption { render_children(node.children) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_child(node : Heading3)
|
def render_child(node : Heading2)
|
||||||
h3 { render_children(node.children) }
|
h2 { render_children(node.children) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_child(node : Heading4)
|
def render_child(node : Heading3)
|
||||||
h4 { render_children(node.children) }
|
h3 { render_children(node.children) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_child(child : IFrame)
|
def render_child(child : IFrame)
|
||||||
|
|
|
@ -39,10 +39,10 @@ module Nodes
|
||||||
class FigureCaption < Container
|
class FigureCaption < Container
|
||||||
end
|
end
|
||||||
|
|
||||||
class Heading3 < Container
|
class Heading2 < Container
|
||||||
end
|
end
|
||||||
|
|
||||||
class Heading4 < Container
|
class Heading3 < Container
|
||||||
end
|
end
|
||||||
|
|
||||||
class ListItem < Container
|
class ListItem < Container
|
||||||
|
|
Loading…
Reference in a new issue