Sha256: 6d2f71f0d57cc4cada186efc0ab4ec34202216998b5e4077d8b553dfd08464bf

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

# -*- coding: utf-8 -*-
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.

require 'review/markdownbuilder'

module ReVIEW

  class MD2INAOBuilder < MARKDOWNBuilder
    def paragraph(lines)
      puts " " + lines.join
      puts "\n"
    end

    def list_header(id, caption, lang)
      lang ||= ""
      puts "```#{lang}"
      print %Q[●リスト#{@chapter.list(id).number}::#{compile_inline(caption)}\n\n]
    end

    def cmd(lines)
      # WEB+DB では使っていないらしいけど
      puts "!!! cmd"
      lines.each do |line|
        puts detab(line)
      end
      puts ""
    end

    def dl_begin
      puts '<dl>'
    end

    def dt(line)
      puts "<dt>#{line}</dt>"
    end

    def dd(lines)
      puts "<dd>#{lines.join}</dd>"
    end

    def dl_end
      puts '</dl>'
    end

    def comment(lines, comment = nil)
      lines ||= []
      lines.unshift comment unless comment.blank?
      str = lines.join("\n")
      puts '<span class="red">'
      puts str
      puts '</span>'
    end

    def compile_ruby(base, ruby)
      if base.length == 1
        %Q[<span class='monoruby'>#{escape_html(base)}(#{escape_html(ruby)})</span>]
      else
        %Q[<span class='groupruby'>#{escape_html(base)}(#{escape_html(ruby)})</span>]
      end
    end

  end

end # module ReVIEW

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
review-2.1.0 lib/review/md2inaobuilder.rb