fdoc

subroutineinline_smartpureprivate

pure subroutine inline_smart(text, i, out, used)

Handle the punctuation that the smarty extension changes.

Arguments

NameTypeIntentAttributesDescription
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
pure subroutine inline_smart(text, i, out, used)
    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
    logical :: opening

    used = 0
    opening = i == 1
    if (.not. opening) opening = scan(text(i - 1:i - 1), ' '//NL//'([{-') == 1
    select case (text(i:i))
    case ('-')
        if (i + 2 <= len(text)) then
            if (text(i:i + 2) == '---') then
                call add(out, '&mdash;')
                used = 3
                return
            end if
        end if
        if (i + 1 <= len(text)) then
            if (text(i:i + 1) == '--') then
                call add(out, '&ndash;')
                used = 2
            end if
        end if
    case ('.')
        if (i + 2 <= len(text)) then
            if (text(i:i + 2) == '...') then
                call add(out, '&hellip;')
                used = 3
            end if
        end if
    case ('"')
        call add(out, merge('&ldquo;', '&rdquo;', opening))
        used = 1
    case ("'")
        call add(out, merge('&lsquo;', '&rsquo;', opening))
        used = 1
    end select
end subroutine inline_smart

Graphs

Calls

Called by