Gregory Kuhn
Gregory Kuhn

Reputation: 1697

restructuredText inline literal that can wrap to the next line (for PDF output)

I am using restructuredText to create a report which includes tom log file outputs.

What I have is a number of sections with numbered lists of literals. This looks like this:

#. ``some log file output``
#. ``more output``

Now the problem with this is that when I convert to a PDF from this using rst2pdf, the literals can sometimes be quite long and flow off the page.

What I would love is away to mark a section of text as a code literal that can flow onto the next line just like regular text.

I want this because if I don't mark the log file output as being a literal, there is sometimes some crud within the log file output which rst is interpreting as inline markup or other rst related commands.

Any other suggestions as to how this can be best done?

I know that I could ensure that the source rst file only has lines of a certain width but this would make the source file look horrible and make it unwieldy to edit.

I have tried the following 2 things, both of which don't help:

I found a rst2pdf option:

--fit-literal-mode=MODE
                What to do when a literal is too wide.
                One of error,overflow,shrink,truncate. 
                Default="shrink"

After some researching, I found mention of a wrapping option for literals. I got rst2pdf to dump out the default stylesheet using:

rst2pdf --print-stylesheet which I then saved and modified such that the wordWrap option under literal was changed to CJK.

Upvotes: 6

Views: 1073

Answers (0)

Related Questions