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

Output list of guides into index page template.

parent 626d9fea
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -223,6 +223,7 @@ module JsDuck
      html.gsub!("{extjs_path}", @opts.extjs_path)
      html.gsub!("{local_storage_db}", @opts.local_storage_db)
      html.gsub!("{categories}", @categories.to_html)
      html.gsub!("{guides}", @guides.to_html)
      html.gsub!("{head_html}", @opts.head_html)
      html.gsub!("{body_html}", @opts.body_html)
      FileUtils.rm(@opts.output_dir+"/template.html")
+19 −0
Original line number Diff line number Diff line
@@ -52,6 +52,25 @@ module JsDuck
      @guides
    end

    # Returns HTML listing of guides
    def to_html
      return "" if @guides.length == 0

      html = @guides.map do |group|
        [
          "<h3>#{group['title']}</h3>",
          "<ul>",
          group["items"].map {|g| "<li><a href='#!/guide/#{g['name']}'>#{g['title']}</a></li>" },
          "</ul>",
        ]
      end.flatten.join("\n")

      return <<-EOHTML
        <div id='guides-content' style='display:none'>
            #{html}
        </div>
      EOHTML
    end
  end

end
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
  </form>

  {categories}
  {guides}
  {footer}

  {body_html}