subroutineadmonition_startprivate
subroutine admonition_start(line, prefix, kind, rest)
The admonition type that starts at line, or '', with where it is and what follows it.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| line | character(len=*) | in | the line | |
| prefix | character(len=*) | in |
| |
| kind | character(len=:) | out | allocatable | the type, in lowercase, or |
| rest | character(len=:) | out | allocatable | what follows it |
Calls
Source
Show the code
subroutine admonition_start(line, prefix, kind, rest)
character(len=*), intent(in) :: line !! the line
character(len=*), intent(in) :: prefix !! `@` or `@end`
character(len=:), allocatable, intent(out) :: kind !! the type, in lowercase, or `''`
character(len=:), allocatable, intent(out) :: rest !! what follows it
character(len=*), parameter :: KINDS(*) = [character(len=7) :: 'note', 'warning', 'todo', 'bug', 'history']
integer :: k, at, n
kind = ''
rest = ''
at = verify(line, ' ')
if (at == 0) return
do k = 1, size(KINDS)
n = len_trim(KINDS(k))
if (at + len(prefix) + n - 1 > len(line)) cycle
if (lowercase(line(at:at + len(prefix) + n - 1)) == prefix//KINDS(k) (1:n)) then
kind = KINDS(k) (1:n)
rest = strip(line(at + len(prefix) + n:))
return
end if
end do
end subroutine admonition_start