fdoc

subroutinepage_sourceprivate

subroutine page_source(site, id, b)

Write the source of entity id, the last section of its page: all of it for a file, which is numbered, and folded away for anything else.

Arguments

NameTypeIntentAttributesDescription
sitetype(site_t)in

the site

idintegerin

the entity

btype(buffer_t)inout

the HTML

Calls

Called by

Source

Show the code
subroutine page_source(site, id, b)
    type(site_t), intent(in) :: site        !! the site
    integer, intent(in) :: id               !! the entity
    type(buffer_t), intent(inout) :: b      !! the HTML

    associate (e => site%p%list%box(id)%e)
        select case (e%kind)
        case (E_FILE)
            if (site%s%incl_src .and. allocated(e%source_text)) then
                call add(b, '<h2 id="source">Source</h2>'//achar(10)//'<pre class="source"><code>')
                call highlight_fortran(e%source_text, b, .true.)
                call add(b, '</code></pre>'//achar(10))
            end if
        case (E_SUBROUTINE, E_FUNCTION, E_MODPROC, E_TYPE)
            if (merged_body(site, id) > 0) then
                call source_section(site, id, b, 'Show the interface')
                call source_section(site, merged_body(site, id), b, 'Show the implementation', .false.)
            else
                call source_section(site, id, b, 'Show the code')
            end if
        end select
    end associate
end subroutine page_source