Commit cfec706d authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Added properties table to documentation page.

parent c96a9ade
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ module JsDuck
       description,
       "<div class='hr'></div>",
       configs,
       properties,
       "</div>",
      ].join("\n")
    end
@@ -65,6 +66,31 @@ module JsDuck
       "</tr>",
      ].join("")
    end

    def properties
      [
       "<a id='#{@cls.full_name}-props'></a>",
       "<h2>Public Properties</h2>",
       "<table cellspacing='0' class='member-table'><tbody>",
       "<tr><th colspan='2' class='sig-header'>Property</th><th class='msource-header'>Defined By</th></tr>",
       @cls[:property].collect {|prop| property_row(prop) }.join("\n"),
       "</tbody></table>",
      ].join("\n")
    end

    def property_row(prop)
      [
       "<tr class='property-row'>",
         "<td class='micon'><a href='#expand' class='exi'>&nbsp;</a></td>",
         "<td class='sig'>",
           "<a id='#{@cls.full_name}-#{prop[:name]}'></a>",
           "<b><a href='source/sample.html#prop-#{@cls.full_name}-#{prop[:name]}'>#{prop[:name]}</a></b> : #{prop[:type]}",
           "<div class='mdesc'>#{prop[:doc]}</div>",
         "</td>",
         "<td class='msource'>#{@cls.short_name}</td>",
       "</tr>",
      ].join("")
    end
  end

end