fdoc

subroutinestatic_pageprivate

subroutine static_page(site, k, html)

Render static page k.

Arguments

NameTypeIntentAttributesDescription
sitetype(site_t)in

the site

kintegerin

the page

htmlcharacter(len=:)outallocatable

the HTML

Calls

Source

Show the code
subroutine static_page(site, k, html)
    type(site_t), intent(in) :: site                    !! the site
    integer, intent(in) :: k                            !! the page
    character(len=:), allocatable, intent(out) :: html  !! the HTML
    type(buffer_t) :: b
    character(len=:), allocatable :: prefix
    integer :: j

    associate (page => site%pages(k))
        prefix = repeat('../', page%depth + 1)
        call page_head(site, page%title, HERE_PAGES, prefix, index(page%html, 'math/tex') > 0, b)
        call add(b, '<aside class="side tree">'//achar(10)//'<ul>')
        call page_links(site, 0, prefix, b)
        call add(b, '</ul>'//achar(10)//'</aside>'//achar(10)//'<main><div class="inner">'//achar(10))
        if (page%parent > 0) then
            call add(b, '<div class="crumbs">')
            j = page%parent
            call add(b, '<a href="'//prefix//'page/'//site%pages(j)%path//'">')
            call html_escape(site%pages(j)%title, b, .false.)
            call add(b, '</a></div>'//achar(10))
        end if
        call add(b, '<h1>')
        call html_escape(page%title, b, .false.)
        call add(b, '</h1>'//achar(10))
        if (allocated(page%author) .or. allocated(page%date)) then
            call add(b, '<div class="meta">')
            if (allocated(page%author)) then
                call add(b, '<span>')
                call html_escape(page%author, b, .false.)
                call add(b, '</span>')
            end if
            if (allocated(page%date)) then
                call add(b, '<span>')
                call html_escape(page%date, b, .false.)
                call add(b, '</span>')
            end if
            call add(b, '</div>'//achar(10))
        end if
        call add(b, '<div class="doc">'//achar(10))
        call add(b, page%html)
        call add(b, achar(10)//'</div>'//achar(10))
        call page_foot(site, b)
    end associate
    call take(b, html)
end subroutine static_page

Graphs

Calls

Called by