fdoc

subroutineinline_abbreviationprivate

subroutine inline_abbreviation(t, text, i, out, used)

Handle an abbreviation at i, if there is a whole word there.

Arguments

NameTypeIntentAttributesDescription
ttype(tree_t)in

the conversion

textcharacter(len=*)in

the text

iintegerin

where it is

outtype(buffer_t)inout

the HTML

usedintegerout

how much was used

Calls

Source

Show the code
subroutine inline_abbreviation(t, text, i, out, used)
    type(tree_t), intent(in) :: t           !! the conversion
    character(len=*), intent(in) :: text    !! the text
    integer, intent(in) :: i                !! where it is
    type(buffer_t), intent(inout) :: out    !! the HTML
    integer, intent(out) :: used            !! how much was used
    integer :: k, n

    used = 0
    if (i > 1) then
        if (index(WORD_CHARS, text(i - 1:i - 1)) > 0) return
    end if
    do k = 1, size(t%abbreviations)
        n = len(t%abbreviations(k)%key)
        if (i + n - 1 > len(text)) cycle
        if (text(i:i + n - 1) /= t%abbreviations(k)%key) cycle
        if (i + n <= len(text)) then
            if (index(WORD_CHARS, text(i + n:i + n)) > 0) cycle
        end if
        call add(out, '<abbr title="')
        call html_escape(t%abbreviations(k)%value, out, .true.)
        call add(out, '">'//t%abbreviations(k)%key//'</abbr>')
        used = n
        return
    end do
end subroutine inline_abbreviation

Graphs

Calls

Called by