subroutinefence_languageprivate
subroutine fence_language(info, lang)
The language named after a code fence.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| info | character(len=*) | in | what follows the fence | |
| lang | character(len=:) | out | allocatable | the language, or |
Calls
Source
Show the code
subroutine fence_language(info, lang)
character(len=*), intent(in) :: info !! what follows the fence
character(len=:), allocatable, intent(out) :: lang !! the language, or `''`
integer :: at
lang = info
if (starts_with(lang, '{')) then
at = index(lang, '.')
lang = ''
if (at > 0) lang = info(at + 1:scan(info(at:)//' ', ' }') + at - 2)
return
end if
at = index(lang, ' ')
if (at > 0) lang = lang(:at - 1)
if (starts_with(lang, '.')) lang = lang(2:)
end subroutine fence_language