fdoc

subroutinefind_rulepureprivate

pure subroutine find_rule(block, at, stop_at)

Find a line of block that is a horizontal rule.

Arguments

NameTypeIntentAttributesDescription
blockcharacter(len=*)in

the chunk

atintegerout

where it starts, or 0

stop_atintegerout

where it ends

Calls

Source

Show the code
pure subroutine find_rule(block, at, stop_at)
    character(len=*), intent(in) :: block   !! the chunk
    integer, intent(out) :: at              !! where it starts, or 0
    integer, intent(out) :: stop_at         !! where it ends
    integer :: i, j, last

    at = 0
    stop_at = 0
    i = 1
    do while (i <= len(block))
        j = index(block(i:), NL)
        last = merge(len(block), i + j - 2, j == 0)
        if (is_rule(block(i:last))) then
            at = i
            stop_at = last
            return
        end if
        if (j == 0) return
        i = i + j
    end do
end subroutine find_rule

Graphs

Calls

Called by