fdoc

subroutinequote_blockrecursiveprivate

recursive subroutine quote_block(t, parent, block, at)

The block quote processor.

Arguments

NameTypeIntentAttributesDescription
ttype(tree_t)inout

the conversion

parentintegerin

the node

blockcharacter(len=*)in

the chunk

atintegerin

where the quote starts

Calls

Source

Show the code
recursive subroutine quote_block(t, parent, block, at)
    type(tree_t), intent(inout) :: t        !! the conversion
    integer, intent(in) :: parent           !! the node
    character(len=*), intent(in) :: block   !! the chunk
    integer, intent(in) :: at               !! where the quote starts
    type(string_t), allocatable :: lines(:)
    integer :: k, first, sibling, quote

    if (at > 1) call parse_one(t, parent, block(:at - 2))
    lines = split_on(block(at:), NL)
    do k = 1, size(lines)
        first = verify(lines(k)%s//'x', ' ')
        if (first > 4 .or. first > len(lines(k)%s)) cycle
        if (lines(k)%s(first:first) /= '>') cycle
        first = first + 1
        if (first <= len(lines(k)%s)) then
            if (lines(k)%s(first:first) == ' ') first = first + 1
        end if
        lines(k)%s = lines(k)%s(first:)
    end do
    sibling = last_child(t, parent)
    quote = 0
    if (sibling > 0) then
        if (t%nodes(sibling)%tag == 'blockquote') quote = sibling
    end if
    if (quote == 0) call new_node(t, parent, 'blockquote', quote)
    call set_state(t, 'blockquote')
    call parse_text(t, quote, join(lines, NL))
    call reset_state(t)
end subroutine quote_block

Graphs

Calls

Called by