Class: Aozora2Html::Tag::Midashi

Inherits:
ReferenceMentioned show all
Defined in:
lib/aozora2html/tag/midashi.rb

Overview

見出し用

Instance Attribute Summary

Attributes inherited from ReferenceMentioned

#target

Instance Method Summary collapse

Methods inherited from ReferenceMentioned

#block_element?, #target_string

Methods inherited from Aozora2Html::Tag

#char_type, #inspect, #syntax_error

Constructor Details

#initialize(parser, target, size, type) ⇒ Midashi

Returns a new instance of Midashi.



7
8
9
10
11
12
13
# File 'lib/aozora2html/tag/midashi.rb', line 7

def initialize(parser, target, size, type)
  super
  @target = target
  @tag = Utils.create_midashi_tag(size)
  @id = parser.new_midashi_id(size)
  @class = Utils.create_midashi_class(type, @tag)
end

Instance Method Details

#to_sObject



15
16
17
# File 'lib/aozora2html/tag/midashi.rb', line 15

def to_s
  "<#{@tag} class=\"#{@class}\"><a class=\"midashi_anchor\" id=\"midashi#{@id}\">#{@target}</a></#{@tag}>"
end