Closed mrietveld closed 8 years ago
Thanks for this fix. What worries, me though, is that it seems like this is invalid DocBook and there are a lot of such scenarios that perhaps we shouldn't fix. Is it even valid to have a program listing inside a paragraph?
I'm okay with addressing corner cases that appear frequently, perhaps like this one, but I think we should have a least some restrictions on what DocBook we allow. We can expect some cleanup occur before we touch the DocBook. (Another goal, perhaps, for the planned contributing guide).
This is related to #25:
This is actually a bug.
The
format_text
method inlib/docbookrx/docbookrx_visitors.rb
calls@lines.pop
, which causes problems when we have nested elements.For example:
The first
listitem
is formatted correctly -- while the second is not. The problem is that the code doesn't expect the<para>
element to contain the<programlisting>
, and pops the formatting for the[source]
("----" in this case), so that you get something that looks like this:The problem is that we have the following code in
format_text
:and in
visit_listitem
we have:This means that the text is appended to
@lines
, then the<programlisting>
element is processed (and added to@lines
byproceed node
informat_text
) and only then is the marker added.. which gives us the incorrect asciidoc shown above.