@lang tag not processed if the <caption> and @lang tags are both included into the @example source directly; I assume this is not intended, as otherwise @lang processing would be conditionally dependent on presence of <caption>.
Thus this is a bug, and the reason is, that when <caption> is present, the example has first line removed, and processing is continued for @lang on modified example, which already does not have the original line.
Goals
Keep existing behavior, as there are special cases, such as trailing commentary.
Effectively keep the design/logic.
Maintain existing coding style.
Keep changes to minimum.
Solution
Process @lang before <caption>, for the special case <caption>@lang cmd comment</caption>; Otherwise in such case language would be processed, but still remain within caption, which is inappropriate.
Modify the lines first, instead of example object itself, and assign the modified lines(if modification happened) to example after processing <caption> and @lang, as it minimizes the needed changes.
Note
There are behaviors, such as <capt@lang cmd ion>comment</caption>, which I did not touch due to reasons described in goals.
There is currently a workaround of using ``` directly in the source.
Issue
@lang
tag not processed if the<caption>
and@lang
tags are both included into the@example
source directly; I assume this is not intended, as otherwise@lang
processing would be conditionally dependent on presence of<caption>
.Thus this is a bug, and the reason is, that when
<caption>
is present, theexample
has first line removed, and processing is continued for@lang
on modifiedexample
, which already does not have the original line.Goals
Solution
@lang
before<caption>
, for the special case<caption>@lang cmd comment</caption>
; Otherwise in such case language would be processed, but still remain within caption, which is inappropriate.lines
first, instead ofexample
object itself, and assign the modifiedlines
(if modification happened) toexample
after processing<caption>
and@lang
, as it minimizes the needed changes.Note
<capt@lang cmd ion>comment</caption>
, which I did not touch due to reasons described in goals.```
directly in the source.