Class: PrawnHtml::Tags::H

Inherits:
PrawnHtml::Tag show all
Defined in:
lib/prawn_html/tags/h.rb

Constant Summary collapse

ELEMENTS =
[:h1, :h2, :h3, :h4, :h5, :h6].freeze
MARGINS_TOP =
{
  h1: 25,
  h2: 20.5,
  h3: 18,
  h4: 21.2,
  h5: 21.2,
  h6: 22.8
}.freeze
MARGINS_BOTTOM =
{
  h1: 15.8,
  h2: 15.8,
  h3: 15.8,
  h4: 20,
  h5: 21.4,
  h6: 24.8
}.freeze
SIZES =
{
  h1: 31.5,
  h2: 24,
  h3: 18.7,
  h4: 15.7,
  h5: 13,
  h6: 10.8
}.freeze

Constants inherited from PrawnHtml::Tag

PrawnHtml::Tag::CALLBACKS, PrawnHtml::Tag::TAG_CLASSES

Instance Attribute Summary

Attributes inherited from PrawnHtml::Tag

#attrs, #parent, #tag

Instance Method Summary collapse

Methods inherited from PrawnHtml::Tag

#block_styles, class_for, #initialize, #process_styles, #tag_close_styles, #tag_open_styles

Constructor Details

This class inherits a constructor from PrawnHtml::Tag

Instance Method Details

#block?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/prawn_html/tags/h.rb', line 35

def block?
  true
end

#tag_stylesObject



39
40
41
42
43
44
45
46
# File 'lib/prawn_html/tags/h.rb', line 39

def tag_styles
  <<~STYLES
    font-size: #{SIZES[tag]}px;
    font-weight: bold;
    margin-bottom: #{MARGINS_BOTTOM[tag]}px;
    margin-top: #{MARGINS_TOP[tag]}px;
  STYLES
end