fdoc

subroutineentity_pageprivate

subroutine entity_page(site, id, html)

Render the page of entity id.

Arguments

NameTypeIntentAttributesDescription
sitetype(site_t)in

the site

idintegerin

the entity

htmlcharacter(len=:)outallocatable

the page

Calls

Source

Show the code
subroutine entity_page(site, id, html)
    type(site_t), intent(in) :: site                    !! the site
    integer, intent(in) :: id                           !! the entity
    character(len=:), allocatable, intent(out) :: html  !! the page
    type(buffer_t) :: b, side
    integer, allocatable :: variables(:), functions(:), subroutines(:), interfaces(:), abstracts(:), types(:)
    integer, allocatable :: bindings(:), finals(:), lists(:), blocks(:), implementations(:), enums(:)
    character(len=:), allocatable :: word, text
    integer :: here

    call children_of(site, id, 1, variables)
    call children_of(site, id, 2, functions)
    call children_of(site, id, 3, subroutines)
    call children_of(site, id, 4, interfaces)
    call children_of(site, id, 5, abstracts)
    call children_of(site, id, 6, types)
    call children_of(site, id, 7, bindings)
    call children_of(site, id, 8, finals)
    call children_of(site, id, 9, lists)
    call children_of(site, id, 10, blocks)
    call children_of(site, id, 11, enums)
    call children_of(site, id, 12, implementations)

    associate (e => site%p%list%box(id)%e)
        here = list_of(site, id)
        select case (e%kind)
        case (E_MODULE); word = 'module'
        case (E_SUBMODULE); word = 'submodule'
        case (E_PROGRAM); word = 'program'
        case (E_BLOCKDATA); word = 'block data'
        case (E_SUBROUTINE); word = 'subroutine'
        case (E_FUNCTION); word = 'function'
        case (E_MODPROC); word = 'module procedure'
        case (E_INTERFACE); word = 'interface'
        case (E_TYPE); word = 'type'
        case (E_NAMELIST); word = 'namelist'
        case default; word = 'file'
        end select
        if (e%iface == IFACE_EXPLICIT) word = 'interface'
        if (e%iface == IFACE_ABSTRACT) word = 'abstract interface'

        if (e%kind == E_TYPE) then
            call side_group(site, 'Components', variables, side)
        else
            call side_group(site, 'Variables', variables, side)
        end if
        call side_group(site, 'Interfaces', interfaces, side)
        call side_group(site, 'Abstract interfaces', abstracts, side)
        call side_group(site, 'Types', types, side)
        call side_group(site, 'Functions', functions, side)
        call side_group(site, 'Subroutines', subroutines, side)
        call side_group(site, 'Module procedures', implementations, side)
        call side_group(site, 'Bindings', bindings, side)
        call page_outline(site, id, side)
        call take(side, text)

        call page_head(site, display_name(e), here, '../', uses_math(site, id), b)
        call add(b, '<aside class="side">'//achar(10))
        if (len(text) > 0) call add(b, text)
        call site_side(site, here, '../', b)
        call add(b, '</aside>'//achar(10)//'<main><div class="inner">'//achar(10))
        call entity_title(site, id, word, b)

        select case (e%kind)
        case (E_SUBROUTINE, E_FUNCTION, E_MODPROC)
            call procedure_body(site, id, b)
        case (E_INTERFACE)
            call interface_body(site, id, b)
        case (E_TYPE)
            call type_body(site, id, variables, bindings, finals, b)
        case (E_NAMELIST)
            if (allocated(e%more%args)) then
                call add(b, '<h2>Variables</h2>'//achar(10)//'<ul class="chips">')
                call add_words(e%more%args, b)
                call add(b, '</ul>'//achar(10))
            end if
        case (E_FILE)
            call file_body(site, id, b)
        case default
            call unit_body(site, id, b)
        end select

        call graph_sections(site, id, b)
        if (e%kind /= E_FILE .and. e%kind /= E_INTERFACE .and. e%kind /= E_TYPE .and. e%kind /= E_NAMELIST) then
            if (size(variables) > 0) then
                call add(b, '<h2 id="variables">Variables</h2>'//achar(10))
                call argument_table(site, variables, .true., b)
            end if
            call enum_sections(site, enums, b)
            call common_sections(site, blocks, b)
            call summary_section(site, 'Interfaces', interfaces, b)
            call summary_section(site, 'Abstract interfaces', abstracts, b)
            call summary_section(site, 'Types', types, b)
            call summary_section(site, 'Namelists', lists, b)
            call summary_section(site, 'Functions', functions, b)
            call summary_section(site, 'Subroutines', subroutines, b)
            call summary_section(site, 'Module procedures', implementations, b)
        end if
        call page_foot(site, b)
    end associate
    call take(b, html)
end subroutine entity_page

Graphs

Calls

Called by