pressbooks / pressbooks-book

McLuhan is the default book theme for Pressbooks.
https://pressbooks.org
GNU General Public License v3.0
20 stars 16 forks source link

Internal links to chapters not following the "Chapter-#" title format result are not clickable in PDF exports #1141

Open jocelynpb2 opened 1 year ago

jocelynpb2 commented 1 year ago

Description

In chapters titled “Chapter-#”, the PDF export results in working internal links to chapters.

If the chapter title does not take the form of “Chapter-#”, for example https://integrations.pressbooks.network/linksinpdf/chapter/3rd-chapter/, the PDF exports internal links that cannot be clicked on.

Web versions and EPUB do not appear to be affected.

Steps to Reproduce

  1. In a book, create a chapter with a title that does not follow the form of “Chapter-#” (for example, “2nd Chapter” or “2 Chapter”
  2. In another chapter, create a link to the chapter you created with the title mentioned above.
  3. Using the Malala, McLuhan, Lewis, or Leonard theme, export the book to PDF.
  4. Open PDF and attempt to click on link to “2nd Chapter”.
  5. Go back to the editor and add a link to a chapter that follows the form of “Chapter-#”.
  6. Export to PDF and successfully click on new link.

Expected behavior: Clickable link in PDF export.

Actual behavior: Links to chapters in a book that do not follow the form "Chapter-#" are not clickable in PDF export.

tw77 commented 1 year ago

From testing in bug scrub, it appears this is caused by the path in the chapter URL beginning with a number, e.g. '/2nd-chapter' or https://pressbooks.lib.vt.edu/introearthscience/chapter/2-plate-tectonics/

A workaround is updating the chapter permalink so its path does not begin with a number and linking to this updated URL.

SteelWagstaff commented 1 year ago

Is this identical to https://github.com/pressbooks/pressbooks/issues/3016?