fdoc

subroutineinline_codeprivate

subroutine inline_code(text, i, out, used)

Handle a code span.

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)in

the text

iintegerin

where it starts

outtype(buffer_t)inout

the HTML

usedintegerout

how much was used

Calls

Source

Show the code
subroutine inline_code(text, i, out, used)
    character(len=*), intent(in) :: text    !! the text
    integer, intent(in) :: i                !! where it starts
    type(buffer_t), intent(inout) :: out    !! the HTML
    integer, intent(out) :: used            !! how much was used
    integer :: run, j, m

    run = verify(text(i:)//' ', '`') - 1
    j = i + run
    do while (j <= len(text))
        if (text(j:j) /= '`') then
            j = j + 1
            cycle
        end if
        m = verify(text(j:)//' ', '`') - 1
        if (m == run) then
            call add(out, '<code>')
            call html_escape(strip(text(i + run:j - 1)), out, .false.)
            call add(out, '</code>')
            used = j + run - i
            return
        end if
        j = j + m
    end do
    call add(out, text(i:i + run - 1))
    used = run
end subroutine inline_code

Graphs

Calls

Called by