Class: Aozora2Html::Tag::EmbedGaiji
- Inherits:
-
Gaiji
- Object
- Aozora2Html::Tag
- Inline
- Gaiji
- Aozora2Html::Tag::EmbedGaiji
- Defined in:
- lib/aozora2html/tag/embed_gaiji.rb
Overview
外字注記用
Class Attribute Summary collapse
-
.use_jisx0213 ⇒ Object
Returns the value of attribute use_jisx0213.
-
.use_unicode ⇒ Object
Returns the value of attribute use_unicode.
Instance Attribute Summary collapse
-
#unicode ⇒ Object
Returns the value of attribute unicode.
Instance Method Summary collapse
-
#initialize(parser, folder, code, name, unicode_num = nil, gaiji_dir:) ⇒ EmbedGaiji
constructor
A new instance of EmbedGaiji.
- #jisx0213_to_unicode(code) ⇒ Object
- #to_s ⇒ Object
Methods inherited from Gaiji
Methods inherited from Aozora2Html::Tag
#char_type, #inspect, #syntax_error
Constructor Details
#initialize(parser, folder, code, name, unicode_num = nil, gaiji_dir:) ⇒ EmbedGaiji
Returns a new instance of EmbedGaiji.
28 29 30 31 32 33 34 35 |
# File 'lib/aozora2html/tag/embed_gaiji.rb', line 28 def initialize(parser, folder, code, name, unicode_num = nil, gaiji_dir:) @folder = folder @code = code @name = name @unicode = unicode_num @gaiji_dir = gaiji_dir super end |
Class Attribute Details
.use_jisx0213 ⇒ Object
Returns the value of attribute use_jisx0213.
17 18 19 |
# File 'lib/aozora2html/tag/embed_gaiji.rb', line 17 def use_jisx0213 @use_jisx0213 end |
.use_unicode ⇒ Object
Returns the value of attribute use_unicode.
25 26 27 |
# File 'lib/aozora2html/tag/embed_gaiji.rb', line 25 def use_unicode @use_unicode end |
Instance Attribute Details
#unicode ⇒ Object
Returns the value of attribute unicode.
7 8 9 |
# File 'lib/aozora2html/tag/embed_gaiji.rb', line 7 def unicode @unicode end |
Instance Method Details
#jisx0213_to_unicode(code) ⇒ Object
37 38 39 |
# File 'lib/aozora2html/tag/embed_gaiji.rb', line 37 def jisx0213_to_unicode(code) Aozora2Html::JIS2UCS[code] end |
#to_s ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/aozora2html/tag/embed_gaiji.rb', line 41 def to_s if Aozora2Html::Tag::EmbedGaiji.use_jisx0213 && @code jisx0213_to_unicode(@code.to_sym) elsif Aozora2Html::Tag::EmbedGaiji.use_unicode && @unicode "&#x#{@unicode};" else "<img src=\"#{@gaiji_dir}#{@folder}/#{@code}.png\" alt=\"" + GAIJI_MARK + "(#{@name})\" class=\"gaiji\" />" end end |