fdoc

subroutinelink_toprivate

subroutine link_to(site, id, name, b)

Write name, linked to entity id if it can be.

Arguments

NameTypeIntentAttributesDescription
sitetype(site_t)in

the site

idintegerin

the entity, or 0

namecharacter(len=*)in

the text

btype(buffer_t)inout

the HTML

Calls

Source

Show the code
subroutine link_to(site, id, name, b)
    type(site_t), intent(in) :: site        !! the site
    integer, intent(in) :: id               !! the entity, or 0
    character(len=*), intent(in) :: name    !! the text
    type(buffer_t), intent(inout) :: b      !! the HTML
    character(len=:), allocatable :: url

    url = ''
    if (id > 0) then
        associate (e => site%p%list%box(id)%e)
            if (is_shown(site%p%list, id) .or. allocated(e%external_url)) call entity_url(site%p%list, id, url)
        end associate
    end if
    if (len(url) == 0) then
        call html_escape(name, b, .false.)
        return
    end if
    call add(b, '<a href="')
    if (.not. allocated(site%p%list%box(id)%e%external_url)) call add(b, '../')
    call html_escape(url, b, .true.)
    call add(b, '">')
    call html_escape(name, b, .false.)
    call add(b, '</a>')
end subroutine link_to

Graphs

Calls

Called by