asciidoctor / docbookrx

(An early version of) a DocBook to AsciiDoc converter written in Ruby.
MIT License
22 stars 49 forks source link

Leveloffset before/after inclusion resets any previously defined value #46

Open tradej opened 8 years ago

tradej commented 8 years ago

When converting a file that includes another file (let's call them parent and child), DocBookRx prepends and suffixes the include::[] commands in the parent with :leveloffset: 1 and :leveloffset: 0 lines to adjust for the shifted levels in the child. That is IMHO not entirely correct, because it resets the leveloffset set in any document that may include the parent.

I believe that the lines preceding and following the inclusion commands in the parent should be :leveloffset: +1 and :leveloffset: -1 as then they would retain the value set in any document that may include the parent.

mojavelinux commented 8 years ago

At the time I wrote docbookrx, Asciidoctor didn't yet support relative level offsets. Now that it does, I definitely agree they should be used.

Even better is to define the offset directly on the include directive.

include::other-file.adoc[leveloffset=<n>]
tradej commented 8 years ago

Oh, I didn't know you can do that. I'm absolutely for specifying it in the directive.