aozorahack/aozora2html

View on GitHub
lib/aozora2html/tag/inline_font_size.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

class Aozora2Html
  class Tag
    # インラインフォントサイズ指定用
    class InlineFontSize < Aozora2Html::Tag::ReferenceMentioned
      def initialize(parser, target, times, daisho)
        @target = target
        @class = daisho.to_s + times.to_s
        @style = Utils.create_font_size(times, daisho)
        super
      end

      def to_s
        "<span class=\"#{@class}\" style=\"font-size: #{@style};\">#{@target}</span>"
      end
    end
  end
end