fdoc

subroutinelist_pageprivate

subroutine list_page(site, which, html)

Render list page which.

Arguments

NameTypeIntentAttributesDescription
sitetype(site_t)in

the site

whichintegerin

the list

htmlcharacter(len=:)outallocatable

the page

Calls

Source

Show the code
subroutine list_page(site, which, html)
    type(site_t), intent(in) :: site                    !! the site
    integer, intent(in) :: which                        !! the list
    character(len=:), allocatable, intent(out) :: html  !! the page
    type(buffer_t) :: b
    character(len=:), allocatable :: url
    logical :: described
    integer :: k

    call page_head(site, trim(LIST_TITLE(which)), which, '../', .false., b)
    call add(b, '<aside class="side">'//achar(10))
    call site_side(site, which, '../', b)
    call add(b, '</aside>'//achar(10)//'<main><div class="inner">'//achar(10))
    call add(b, '<h1>'//trim(LIST_TITLE(which))//'</h1>'//achar(10))
    if (which == LIST_FILES) then
        call add(b, '<table class="listing sortable">'//achar(10)//'<thead><tr><th>'//trim(LIST_NOUN(which))//'</th>')
    else
        call add(b, '<table class="listing">'//achar(10)//'<thead><tr><th>'//trim(LIST_NOUN(which))//'</th>')
    end if
    select case (which)
    case (LIST_FILES)
        call add(b, '<th class="num">Lines</th><th class="num">Code</th><th class="num">Comments</th>')
        call add(b, '<th class="num">Blank</th><th class="num">Size</th><th class="num">Procedures</th>')
    case (LIST_MODULES, LIST_PROGRAMS, LIST_BLOCKDATA)
        call add(b, '<th>Source File</th>')
    case (LIST_PROCEDURES)
        call add(b, '<th>Location</th><th>Type</th>')
    case (LIST_ABSINT, LIST_NAMELISTS)
        call add(b, '<th>Location</th>')
    case (LIST_TYPES)
        call add(b, '<th>Location</th><th>Extends</th>')
    end select
    ! what a file is about is rarely given, and the list of files is wide
    described = which /= LIST_FILES
    do k = 1, size(site%members(which)%ids)
        if (described) exit
        if (allocated(site%p%list%box(site%members(which)%ids(k))%e%summary)) then
            described = len_trim(site%p%list%box(site%members(which)%ids(k))%e%summary) > 0
        end if
    end do
    if (described) call add(b, '<th>Description</th>')
    call add(b, '</tr></thead>'//achar(10)//'<tbody>'//achar(10))
    do k = 1, size(site%members(which)%ids)
        associate (id => site%members(which)%ids(k))
            call entity_url(site%p%list, id, url)
            call add(b, '<tr><td><a href="../')
            call html_escape(url, b, .true.)
            call add(b, '">')
            call html_escape(display_name(site%p%list%box(id)%e), b, .false.)
            call add(b, '</a></td>')
            call list_columns(site, which, id, b)
            if (which == LIST_FILES) call stats_cells(site%file_stats(k), b)
            if (described) then
                call add(b, '<td>')
                if (allocated(site%p%list%box(id)%e%summary)) call add(b, site%p%list%box(id)%e%summary)
                call add(b, '</td>')
            end if
            call add(b, '</tr>'//achar(10))
        end associate
    end do
    call add(b, '</tbody>'//achar(10))
    if (which == LIST_FILES) call stats_total(site, described, b)
    call add(b, '</table>'//achar(10))
    do k = 1, size(site%graphs%graphs)
        if (site%graphs%graphs(k)%list_page == which) call write_graph(site, k, b)
    end do
    call page_foot(site, b)
    call take(b, html)
end subroutine list_page

Graphs

Calls

Called by