subroutinerender_footnotesrecursiveprivate
recursive subroutine render_footnotes(t, options, out)
Write the footnotes that were referred to.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| t | type(tree_t) | inout | the conversion | |
| options | type(markdown_options_t) | in | what rendering depends on | |
| out | type(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 = ' <a class="footnote-backref" href="#fnref:'//id//'" title="Jump back to footnote '// &
trim(int_text(k))//' in the text">↩</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