pietroppeter / nimibook

A port of mdbook to nim(ib)
https://pietroppeter.github.io/nimibook/
MIT License
77 stars 7 forks source link

Missing "next" arrow in page #59

Closed pietroppeter closed 1 year ago

pietroppeter commented 1 year ago

Seen in this live example: https://philippmdoerner.github.io/Snorlogue/bookCompiled/customDatatypes.html

There is an additional entry (change log) but "next" arrow is not appearing (in changelog the "previous" arrow appears)

Cc @PhilippMDoerner

PhilippMDoerner commented 1 year ago

Fascinating, I didn't even notice.

pietroppeter commented 1 year ago

I did fix a bug on this kind of stuff some time ago (evidently did not squash completely the bug) so I kind of look for this stuff ;)

pietroppeter commented 1 year ago

and this the bug I was referring to, likely the bug is in the same part of code: https://github.com/pietroppeter/nimibook/commit/428e482ac7b86e4f12c5ca8c79e419cb47250ea7

for sure not giving a look now at this, so if someone is dying to pick it up... 😝

HugoGranstrom commented 1 year ago

and this the bug I was referring to, likely the bug is in the same part of code: https://github.com/pietroppeter/nimibook/commit/428e482ac7b86e4f12c5ca8c79e419cb47250ea7

Looking at line 53 in entries.nim:

if j >= 0 and j < book.toc.entries.high:
  result = book.toc.entries[j].url

j < book.toc.entries.high means that if j is the last entry (book.toc.entries.high), the body won't run and we won't get an arrow on the second to last page. If we change it to j <= book.toc.entries.high it should work. (in my head at least)

HugoGranstrom commented 1 year ago

Can confirm that it works locally, will add this to my upcoming PR as well.