fdoc

subroutineprocedure_docprivate

subroutine procedure_doc(site, id, b)

Write the documentation of procedure id with its arguments and result after the first paragraph, so that they come before a long description. The body of a separate module procedure without a first paragraph of its own takes the summary of its interface.

Arguments

NameTypeIntentAttributesDescription
sitetype(site_t)in

the site

idintegerin

the procedure

btype(buffer_t)inout

the HTML

Calls

Called by

Source

Show the code
subroutine procedure_doc(site, id, b)
    type(site_t), intent(in) :: site        !! the site
    integer, intent(in) :: id               !! the procedure
    type(buffer_t), intent(inout) :: b      !! the HTML
    character(len=:), allocatable :: html, lead
    integer :: start, body

    associate (e => site%p%list%box(id)%e)
        html = ''
        if (allocated(e%html)) html = e%html
        lead = ''
        start = verify(html, ' '//achar(9)//achar(10)//achar(13))
        if (start > 0) then
            if (html(start:min(len(html), start + 2)) == '<p>') then
                lead = html(:start - 1 + index(html(start:), '</p>') + 3)
                html = html(len(lead) + 1:)
            end if
        end if
        if (len(lead) == 0 .and. is_separate_body(site%p%list, id)) then
            if (allocated(site%p%list%box(e%implements)%e%summary)) lead = site%p%list%box(e%implements)%e%summary
        end if
        call implementation_line(site, id, b)
        call doc_block(lead, b)
        if (allocated(e%more%arg_ids)) then
            if (size(e%more%arg_ids) > 0) then
                call add(b, '<h2 id="arguments">Arguments</h2>'//achar(10))
                call argument_table(site, e%more%arg_ids, .false., b)
            end if
        end if
        if (e%result > 0) then
            call add(b, '<h2 id="result">Result</h2>'//achar(10))
            call argument_table(site, [e%result], .true., b)
        end if
        call doc_block(html, b)
        body = merged_body(site, id)
        if (body > 0) then
            if (allocated(site%p%list%box(body)%e%html)) call doc_block(site%p%list%box(body)%e%html, b)
        end if
    end associate
end subroutine procedure_doc