fdoc

subroutinepage_linksrecursiveprivate

recursive subroutine page_links(site, parent, prefix, b)

Write the pages below page parent, or the top one if that is 0, as a tree of links.

Arguments

NameTypeIntentAttributesDescription
sitetype(site_t)in

the site

parentintegerin

the page

prefixcharacter(len=*)in

from the current page to the root of the site

btype(buffer_t)inout

the HTML

Calls

Source

Show the code
recursive subroutine page_links(site, parent, prefix, b)
    type(site_t), intent(in) :: site        !! the site
    integer, intent(in) :: parent           !! the page
    character(len=*), intent(in) :: prefix  !! from the current page to the root of the site
    type(buffer_t), intent(inout) :: b      !! the HTML
    integer :: k

    do k = 1, size(site%pages)
        if (site%pages(k)%parent /= parent) cycle
        call add(b, '<li><a href="'//prefix//'page/'//site%pages(k)%path//'">')
        call html_escape(site%pages(k)%title, b, .false.)
        call add(b, '</a>')
        if (any(site%pages%parent == k)) then
            call add(b, '<ul>')
            call page_links(site, k, prefix, b)
            call add(b, '</ul>')
        end if
        call add(b, '</li>')
    end do
end subroutine page_links

Graphs

Calls

Called by