Commit 8f42ed64 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Remove old HTML-pages creation code.

parent 9b3c16d9
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@ require 'jsduck/tree_icons'
require 'jsduck/members'
require 'jsduck/relations'
require 'jsduck/aliases'
require 'jsduck/page'
require 'jsduck/exporter'
require 'jsduck/timer'
require 'jsduck/parallel_wrap'
@@ -230,20 +229,6 @@ module JsDuck
      File.open(filename, 'w') {|f| f.write(js) }
    end

    # Writes documentation page for each class
    # We do it in parallel using as many processes as available CPU-s
    def write_pages(path, relations)
      cache = {}
      @parallel.each(relations.classes) do |cls|
        filename = path + "/" + cls[:name] + ".html"
        Logger.instance.log("Writing to #{filename} ...")
        page = Page.new(cls, relations, cache)
        page.link_tpl = @link_tpl if @link_tpl
        page.img_tpl = @img_tpl if @img_tpl
        File.open(filename, 'w') {|f| f.write(page.to_html) }
      end
    end

    # Writes JsonP export file for each class
    def write_class(path, relations)
      exporter = Exporter.new(relations, get_doc_formatter(relations))

lib/jsduck/cfg_table.rb

deleted100644 → 0
+0 −21
Original line number Diff line number Diff line
require 'jsduck/table'

module JsDuck

  class CfgTable < Table
    def initialize(cls, formatter, cache={})
      super(cls, formatter, cache)
      @type = :cfg
      @id = @cls.full_name + "-configs"
      @title = "Config Options"
      @column_title = "Config Options"
      @row_class = "config-row"
    end

    def signature_suffix(item)
      " : " + item[:type]
    end

  end

end

lib/jsduck/event_table.rb

deleted100644 → 0
+0 −33
Original line number Diff line number Diff line
require 'jsduck/table'
require 'jsduck/short_params'
require 'jsduck/long_params'

module JsDuck

  class EventTable < Table
    def initialize(cls, formatter, cache={})
      super(cls, formatter, cache)
      @type = :event
      @id = @cls.full_name + "-events"
      @title = "Public Events"
      @column_title = "Event"
      @row_class = "event-row"
      @short_params = ShortParams.new
      @long_params = LongParams.new(@formatter)
    end

    def signature_suffix(item)
      " : " + @short_params.render(item[:params])
    end

    def extra_doc(item)
      [
        "<div class='mdetail-params'>",
        "<strong style='font-weight: normal;'>Listeners will be called with the following arguments:</strong>",
        @long_params.render(item[:params]),
        "</div>"
      ].join("\n")
    end
  end

end

lib/jsduck/inheritance_tree.rb

deleted100644 → 0
+0 −42
Original line number Diff line number Diff line
module JsDuck

  # Creates the inheritance tree shown on class documentation page.
  class InheritanceTree
    def initialize(cls, formatter)
      @cls = cls
      @formatter = formatter
    end

    # Renders the tree using HTML <pre> element
    def to_html
      i = -1
      html = (@cls.superclasses + [@cls]).collect do |cls|
        i += 1
        make_indent(i) + make_link(cls)
      end.join("\n")

      return <<-EOHTML
        <div class="inheritance res-block">
          <pre class="res-block-inner">#{html}</pre>
        </div>
      EOHTML
    end

    def make_indent(level)
      if level > 0
        ("  " * level) + "<img src='resources/elbow-end.gif' alt=''>"
      else
        ""
      end
    end

    def make_link(cls)
      if cls == @cls
        cls.short_name
      else
        @formatter.link(cls.full_name, nil, cls.short_name)
      end
    end
  end

end

lib/jsduck/long_params.rb

deleted100644 → 0
+0 −30
Original line number Diff line number Diff line
module JsDuck

  # Renders method/event parameters list in long form
  # for use in documentation body.
  class LongParams
    def initialize(formatter)
      @formatter = formatter
    end

    def render(params)
      if params.length > 0
        "<ul>" + params.collect {|p| render_single(p) }.join("") + "</ul>"
      else
        "<ul><li>None.</li></ul>"
      end
    end

    def render_single(param)
      doc = @formatter.format(param[:doc])
      type = @formatter.replace(param[:type])
      return [
        "<li>",
        "<code>#{param[:name]}</code> : #{type}",
        "<div class='sub-desc'>#{doc}</div>",
        "</li>",
      ].join("")
    end
  end

end
Loading