ionelmc / python-darkslide

Generate HTML5 slideshows from markdown, ReST, or textile
http://ionelmc.github.io/python-darkslide/
Apache License 2.0
97 stars 22 forks source link

Fix the TOC when a local TOC is generated on a slide. #7

Closed ptitmain closed 6 years ago

ptitmain commented 7 years ago

Hi, I corrected a bug when a TOC is inserted in a slide. The resulting code includes an additional backref link to handle the local TOC (this is due to the conversion from RST to HTML). Then, a TOC ref appears to be:

<a href="...#slide:xx"> <a href="....#id:yy"> My title </a> </a>

The #id link is generated by the rsttohtml converter and is useless in our case. The #slide:xx link is generated by generator.py. The link is then broken, because of the double link . I filtered the html output with a regex, as done for other useless html things. It works well.

ionelmc commented 7 years ago

This happens when you use the toc directive? Can you add an example in examples/restructuredtext/slides.rst?

codecov-io commented 7 years ago

Codecov Report

Merging #7 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master       #7   +/-   ##
=======================================
  Coverage   55.07%   55.07%           
=======================================
  Files           9        9           
  Lines         650      650           
  Branches      117      117           
=======================================
  Hits          358      358           
  Misses        248      248           
  Partials       44       44
Impacted Files Coverage Δ
src/darkslide/parser.py 58.13% <ø> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 197beed...c1156a8. Read the comment docs.

ptitmain commented 7 years ago

Done !

ptitmain commented 7 years ago

Do you plan to merge ?

ionelmc commented 7 years ago

Yes, this weekend I'll do the merging/releasing.

ionelmc commented 6 years ago

Ok I've tried it now and I finally get what it does: it removes links from headings (that would appear if TOC is used). But then, shouldn't the links in the TOC have the correct #slide:NN value?

ptitmain commented 6 years ago

Yes, it would be better that the slide TOC links works (in the slide content). The TOC, on the left, have correct and working links.

For the links of the slide ocntent, as they are generated by the rst2pdf backend, there is no trivial way of getting the link. No ?

ionelmc commented 6 years ago

Anyway, I'm merging this part. Interested in making a fix for the link replacement? Basically all <a class="internal" href="#stuff" would get a replacement if stuff is one of those toc-backref anchors containing a <hN id="stuff". It would be a change in parser.py ...