From: Roberto A. <ra...@ne...> - 2010-03-30 15:35:24
|
Working on rst2pdf I am trying to implement a new feature (cover pages based on templates) and I need to extract the raw source of the document's title and subtitle, in order to inject them in the cover page template. While the title node has it, the subtitle node doesn't. I can use astext() but that means subtitles with inline elements like literals, italics, etc, get lost. Is that intentional or an omission? |
From: David G. <go...@py...> - 2010-03-30 16:08:31
|
On Tue, Mar 30, 2010 at 11:36, Roberto Alsina <ra...@ne...> wrote: > Working on rst2pdf I am trying to implement a new feature (cover pages based > on templates) and I need to extract the raw source of the document's title and > subtitle, in order to inject them in the cover page template. > > While the title node has it, the subtitle node doesn't. > > I can use astext() but that means subtitles with inline elements like > literals, italics, etc, get lost. > > Is that intentional or an omission? The rawsource attribute is probably lost when the section title is transformed into the subtitle. You can't rely on rawsource for production processing -- it's there for development and debugging only. It's not guaranteed to be on every element. What you're doing sounds like an rst2rst-type problem. -- David Goodger <http://python.net/~goodger> |
From: Roberto A. <ra...@ne...> - 2010-03-30 17:44:50
Attachments:
test_cover.txt
|
On Tuesday 30 March 2010 13:08:24 David Goodger wrote: > On Tue, Mar 30, 2010 at 11:36, Roberto Alsina > > <ra...@ne...> wrote: > > Working on rst2pdf I am trying to implement a new feature (cover pages > > based on templates) and I need to extract the raw source of the > > document's title and subtitle, in order to inject them in the cover page > > template. > > > > While the title node has it, the subtitle node doesn't. > > > > I can use astext() but that means subtitles with inline elements like > > literals, italics, etc, get lost. > > > > Is that intentional or an omission? > > The rawsource attribute is probably lost when the section title is > transformed into the subtitle. Ok. > You can't rely on rawsource for production processing -- it's there > for development and debugging only. It's not guaranteed to be on every > element. > > What you're doing sounds like an rst2rst-type problem. All I want is to be able to do a coverpage template and pass it the title/subtitle/docinfo from the document so the user can create a nice cover page. In fact, I would expect the LaTeX writer to have a similar problem? In fact, it looks like it does! The latex writer seems to ignore any inline markup in document titles and subtitles, but it respects it in section titles. As a test, check the attached file with --document-class=book |
From: Guenter M. <mi...@us...> - 2010-03-31 07:08:13
|
On 2010-03-30, Roberto Alsina wrote: > All I want is to be able to do a coverpage template and pass it the > title/subtitle/docinfo from the document so the user can create a nice cover > page. This should be available from the doctree even without rawsource. With rst2pseudoxml, your test returns a subtitle with inline markup:: <subtitle ids="this-is-the-subtitle" names="this\ is\ the\ subtitle"> This is the <emphasis> Subtitle ... > The latex writer seems to ignore any inline markup in document titles and > subtitles, but it respects it in section titles. > As a test, check the attached file with --document-class=book This is also see with the default "article" document class. Thanks for reporting, I added this issue to the TODO list. Günter |