From: Dave P. <dav...@gm...> - 2014-11-20 07:49:33
|
Thanks for that, no hadn't realised. I'm on Fedora / Linux. I'll try it, regards On 20 November 2014 02:39, Waylan Limberg <way...@ic...> wrote: > Dave, > > In case you haven't followed the ticket, this has been fixed and a new > bugfix release (2.5.2) was just issued: > > https://pypi.python.org/pypi/Markdown/2.5.2 > > All recursion in the offending code has been removed so it should work with > your long document now. I agree that 28000 entries in a TOC would be a > little overwhelming (but less so than trying to find a given part of the > document without a TOC). Perhaps using JavaScript to expand/collapse the TOC > tree would make the long TOC more manageable. Just a suggestion (I don't > know if that's even practical in your use-case or environment). > > I'd like to hear if the fix works for you either way. Markdown should never > crash because of unexpected user input. If your long document is still > causing a crash, I'd like to know about it (its rare to get feedback with > such a long document). > > Waylan Limberg > > > On Nov 17, 2014, at 02:58 AM, Dave Pawson <dav...@gm...> wrote: > > On 17 November 2014 01:58, Waylan Limberg <way...@ic...> wrote: >> Dave, >> >> I'm glad you were able to make that work for you. For the record, I've >> created a bug report for this here: >> https://github.com/waylan/Python-Markdown/issues/366 > > Thanks. From memory there were 28000 entries, set to ## or ### > for the toc to process. I had to cut it into 7 parts, to roughly 4000 > entries is about the max depth? > > Seems recursion is the right idea, just that it needs to be clean tail > recursion. > > Thanks. DaveP > > > > >> >> Waylan >> >> -----Original Message----- >> From: Dave Pawson [mailto:dav...@gm...] >> Sent: Sunday, November 16, 2014 9:03 AM >> To: Waylan Limberg >> Cc: PythonMD list >> Subject: Re: [Python-markdown-discuss] recursion error? >> >> Yes, that worked. 25K lines, no toc, builds the html. >> I can work with that. >> >> Thanks. Dave P >> >> On 16 November 2014 13:34, Waylan Limberg <way...@ic...> >> wrote: >>> The error seems pretty self-explanatory to me. You are getting a >>> recursion >> error in the `build_correct` method of the TOC Extension. A quick look at >> the source indicates that that method recursively calls itself to turn a >> flat list of headers (h1-6) taken from the document and rearranges them >> into >> a properly nested list to use as the Table of Contents. >>> >>> The short answer would be to not use that extension with such a long >> document. But, the correct answer I suppose would be to refactor the >> `build_correct` method to not be recursive - which may be easier said that >> done. >>> >>> Waylan Limberg >>> >>>> On Nov 16, 2014, at 7:11 AM, Dave Pawson <dav...@gm...> wrote: >>>> >>>> 20K line file, >>>> >>>> final error reported is >>>> File "/usr/lib/python2.7/site-packages/markdown/extensions/toc.py", >>>> line 54, in build_correct >>>> if current['level'] > prev_element['level']: >>>> RuntimeError: maximum recursion depth exceeded in cmp >>>> >>>> >>>> Any idea what I should be chasing please, in the md file? >>>> >>>> regards >>>> -- >>>> Dave Pawson >>>> XSLT XSL-FO FAQ. >>>> Docbook FAQ. >>>> http://www.dpawson.co.uk >>>> >>>> --------------------------------------------------------------------- >>>> --------- Comprehensive Server Monitoring with Site24x7. >>>> Monitor 10 servers for $9/Month. >>>> Get alerted through email, SMS, voice calls or mobile push >>>> notifications. >>>> Take corrective actions from your mobile device. >>>> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg >>>> .clktrk _______________________________________________ >>>> Python-markdown-discuss mailing list >>>> Pyt...@li... >>>> https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss >> >> >> >> -- >> Dave Pawson >> XSLT XSL-FO FAQ. >> Docbook FAQ. >> http://www.dpawson.co.uk >> >> >> ---------------------------------------------------------------------------- >> -- >> Comprehensive Server Monitoring with Site24x7. >> Monitor 10 servers for $9/Month. >> Get alerted through email, SMS, voice calls or mobile push notifications. >> Take corrective actions from your mobile device. >> >> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk >> _______________________________________________ >> Python-markdown-discuss mailing list >> Pyt...@li... >> https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss >> > > > > -- > Dave Pawson > XSLT XSL-FO FAQ. > Docbook FAQ. > http://www.dpawson.co.uk > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk |