subroutineinline_codeprivate
subroutine inline_code(text, i, out, used)
Handle a code span.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| text | character(len=*) | in | the text | |
| i | integer | in | where it starts | |
| out | type(buffer_t) | inout | the HTML | |
| used | integer | out | how much was used |
Calls
Source
Show the code
subroutine inline_code(text, i, out, used)
character(len=*), intent(in) :: text !! the text
integer, intent(in) :: i !! where it starts
type(buffer_t), intent(inout) :: out !! the HTML
integer, intent(out) :: used !! how much was used
integer :: run, j, m
run = verify(text(i:)//' ', '`') - 1
j = i + run
do while (j <= len(text))
if (text(j:j) /= '`') then
j = j + 1
cycle
end if
m = verify(text(j:)//' ', '`') - 1
if (m == run) then
call add(out, '<code>')
call html_escape(strip(text(i + run:j - 1)), out, .false.)
call add(out, '</code>')
used = j + run - i
return
end if
j = j + m
end do
call add(out, text(i:i + run - 1))
used = run
end subroutine inline_code