fdoc

subroutineuse_groupprivate

subroutine use_group(site, title, ids, b)

Write a group of ids, collapsed if it is long.

Arguments

NameTypeIntentAttributesDescription
sitetype(site_t)in

the site

titlecharacter(len=*)in

the heading

idsintegerinallocatabledimension(:)

the entities, if any

btype(buffer_t)inout

the HTML

Calls

Called by

Source

Show the code
subroutine use_group(site, title, ids, b)
    type(site_t), intent(in) :: site        !! the site
    character(len=*), intent(in) :: title   !! the heading
    integer, allocatable, intent(in) :: ids(:)  !! the entities, if any
    type(buffer_t), intent(inout) :: b      !! the HTML
    integer, parameter :: LONG = 24
    character(len=:), allocatable :: letter, word
    integer :: k

    if (.not. allocated(ids)) return
    call add(b, '<h3>'//title//' ('//trim(int_text(size(ids)))//')</h3>'//achar(10))
    if (size(ids) > LONG) call add(b, '<details class="specifics"><summary>Show all</summary>'//achar(10))
    call add(b, '<ul class="chips kinds">')
    do k = 1, size(ids)
        associate (e => site%p%list%box(ids(k))%e)
            call icon_of(e, letter, word)
            call add(b, '<li class="ico-'//letter_class(letter)//'">')
            call side_icon(e, b)
            call link_to(site, ids(k), e%name, b)
            call add(b, '</li>')
        end associate
    end do
    call add(b, '</ul>'//achar(10))
    if (size(ids) > LONG) call add(b, '</details>'//achar(10))
end subroutine use_group