my17560 / dokuwiki-template-readthedokus

"Read the Docs" flavored DokuWiki template
MIT License
14 stars 11 forks source link

Sidebar TOC of pages with common prefix are always shown beneath section header even though there is no entry for them in the sidebar #18

Closed fthommen closed 2 years ago

fthommen commented 2 years ago

Hi, that's a rather smallish issue but hard to describe in words. I'm also not completely sure if this is a bug or by design...:-)

Assume this sidebar:

** TEST **

  * [[mypage-old]]

and the pages yourpage.txt, mypage.txt, mypageold.txt and mypage-old.txt. According to the behaviour of the readthedokus template as I have experienced it by now, the TOC of the pages yourpage.txt, mypage.txt and mypageold.txt would be displayed in the top of the sidebar below the generic title "Table of Contents", while the TOC of mypage-old.txt is show in the "TEST" section. In reality also the TOCs of mypage.txt and myoageold.txt are shown in the "TEST" section:

yourpage.txt TOC placement is ok, as there is no entry for this page in the sidebar:

yourpage

mypage-old.txt TOC placement is ok, too, because it has an entry in the sidebar:

mypage-old

mypage.txt TOC placement is probably wrong. It should be in "Table of Contents" above "TEST" because there is not entry for this page in the sidebar:

mypage

same with mypageold.txt:

mypageold

I assume - w/o having tested this in detail - that the problem is related to pagenames with a common prefix.

my17560 commented 2 years ago

Thanks for your report. I confirmed the bug (except mypageold.txt). I was judging whether a sidebar link contains the current page id in its link.

e.g. If the current page id is "mypage-old", a link to "mypage-old" matches because it contains the word "mypage-old" - OK. If the current page id is "mypage", a link to "mypage-old" matches because it contains the word "mypage" - NG.

I think I found a more accurate way to match a link. I modified and released it to GitHub. I'll test a bit more and release it officially.

fthommen commented 2 years ago

In the meantime it seems all completely. Thanks once again a lot :-)