OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: RE: [docbook-apps] dynamic chunk.section.depth


Hi David,
That's exactly what I did. In my processing from LaTeX to DocBook, I set a remark with role=toc2 or role=toc3 depending on the tag the writer used. Then, using lxml I do this in python postprocessing of the xml:
----------------------------------------------------------
def set_chunklevel(self, tree):
    for section in tree.xpath('/d:chapter/d:section/d:section',namespaces=xns):
        stop_chunking = etree.ProcessingInstruction('dbhtml', text='stop-chunking')
        remark = section.xpath('child::d:para/d:remark',namespaces=xns)
        if not remark:
            section.insert(0,stop_chunking)
        elif remark[0].get('role') == 'toc2':
           section.insert(0,stop_chunking)
----------------------------------------------------------

so if there is no remark in the 2nd level section I stop chunking.
if there is a remark and it has role=toc2, I stop chunking.
otherwise (there's a remark and it has role=toc3 and so I let it chunk to chunker.section.depth

I was pretty worried about the navigation going haywire, but for my one test of today it looks fine.
I'll google more about it on Monday to see if I'm just getting lucky on this one chapter's navigation.

thanks!
--Tim



> -----Original Message-----
> From: David Cramer [mailto:dcramer@motive.com]
> Sent: Friday, April 16, 2010 3:47 PM
> To: Tim Arnold; docbook-apps@lists.oasis-open.org
> Subject: RE: [docbook-apps] dynamic chunk.section.depth
> 
> Hi Tim,
> You might be able to make use of the stop-chunking PI or at least be
> inspired by it:
> http://docbook.sourceforge.net/release/xsl/current/doc/pi/dbhtml_stop-ch
> unking.html
> 
> For your situation, you would set the depth to 3 and add the PI to any
> 2nd level sections when you don't want deeper chunking.
> 
> If you choose to customize, you can at least grep for "stop-chunking"
> for inspiration. There are several things to change in order to get the
> Next and Prev links to come out right.
> 
> Good luck,
> David
> 
> > -----Original Message-----
> > From: Tim Arnold [mailto:Tim.Arnold@sas.com]
> > Sent: Friday, April 16, 2010 2:04 PM
> > To: docbook-apps@lists.oasis-open.org
> > Subject: [docbook-apps] dynamic chunk.section.depth
> >
> > Hi,
> > I suppose it is impossible to set the chunk.section.depth
> > dynamically, but maybe some of you will have an idea about
> > how to solve my problem.
> >
> > For the most part we want our documents chunked to a depth of
> > 2. Some sections however are very mathematically dense and/or
> > long, which can lead to some very heavy HTML pages. For these
> > dense sections we'd like to chunk to a depth of 3.
> >
> > My first guess is that I will customize the chunk template
> > which determines what is or is not a chunk, maybe adding a
> > parameter to that template to tell the section depth, but I'm
> > not sure how to vary that within the document.
> >
> > any ideas?
> >
> > thanks,
> > --Tim Arnold
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> > For additional commands, e-mail:
> > docbook-apps-help@lists.oasis-open.org
> >
> >



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]