fdoc

subroutinerender_footnotesrecursiveprivate

recursive subroutine render_footnotes(t, options, out)

Write the footnotes that were referred to.

Arguments

NameTypeIntentAttributesDescription
ttype(tree_t)inout

the conversion

optionstype(markdown_options_t)in

what rendering depends on

outtype(buffer_t)inout

the HTML

Calls

Source

Show the code
recursive subroutine render_footnotes(t, options, out)
    type(tree_t), intent(inout) :: t                !! the conversion
    type(markdown_options_t), intent(in) :: options !! what rendering depends on
    type(buffer_t), intent(inout) :: out            !! the HTML
    character(len=:), allocatable :: html, back, id
    integer :: k, at

    if (.not. any(t%notes%used)) return
    call add(out, NL//'<div class="footnote">'//NL//'<hr>'//NL//'<ol>'//NL)
    do k = 1, size(t%notes)
        if (.not. t%notes(k)%used) cycle
        id = t%notes(k)%id
        call markdown_to_html(t%notes(k)%text, options, html)
        back = '&#160;<a class="footnote-backref" href="#fnref:'//id//'" title="Jump back to footnote '// &
               trim(int_text(k))//' in the text">&#8617;</a>'
        at = index(html, '</p>', back=.true.)
        if (at > 0) then
            html = html(:at - 1)//back//html(at:)
        else
            html = html//back
        end if
        call add(out, '<li id="fn:'//id//'">'//NL)
        call add(out, html)
        call add(out, NL//'</li>'//NL)
    end do
    call add(out, '</ol>'//NL//'</div>')
end subroutine render_footnotes

Graphs

Calls

Called by