my17560 / dokuwiki-template-readthedokus

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

Since version 2024-05-18, TOC is not displayed any more #89

Closed fthommen closed 5 months ago

fthommen commented 6 months ago

Hi,

with DokuWiki 2024-02-06 "Kaos", the TOC is not displayed in the sidebar any more. Example with version 2023-08-22:

Screenshot 2024-05-29 at 17 04 28

Same with version 2024-05-18: Screenshot 2024-05-29 at 17 05 57

When selecing the page in the sidebar, I get the following error message in the webserver (NGINX) log:

2024/05/29 17:10:58 [error] 103899#103899: *105 FastCGI sent in stderr: "PHP message: PHP Warning:  Undefined array key "pub:development:rstudio-workbench" in /local/dokuwiki/lib/plugins/loadskin/action.php on line 196; PHP message: PHP Warning:  Undefined array key "pub:development:rstudio-workbench" in /local/dokuwiki/lib/plugins/loadskin/action.php on line 202; PHP message: PHP Warning:  Undefined array key "pub:development" in /local/dokuwiki/lib/plugins/loadskin/action.php on line 202" while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: site.dom.ain, request: "GET /pub/development/rstudio-workbench HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.2-fpm.sock:", host: "site.dom.ain", referrer: "https://site.dom.ain/pub/development/jupyterhub"
2024/05/29 17:10:58 [error] 103899#103899: *105 FastCGI sent in stderr: "; PHP message: PHP Warning:  Undefined array key "pub:development:rstudio-workbench" in /local/dokuwiki/lib/plugins/loadskin/action.php on line 196; PHP message: PHP Warning:  Undefined array key "pub:development:rstudio-workbench" in /local/dokuwiki/lib/plugins/loadskin/action.php on line 202; PHP message: PHP Warning:  Undefined array key "pub:development" in /local/dokuwiki/lib/plugins/loadskin/action.php on line 202" while reading upstream, client: xxx.xxx.xxx.xxx, server: site.dom.ain, request: "GET /pub/development/rstudio-workbench HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.2-fpm.sock:", host: "site.dom.ain", referrer: "https://site.dom.ain/pub/development/jupyterhub"
2024/05/29 17:10:58 [error] 103899#103899: *105 open() "/local/dokuwiki/lib/tpl/readthedokus/images/apple-touch-icon.png" failed (2: No such file or directory), client: xxx.xxx.xxx.xxx, server: site.dom.ain, request: "GET /lib/tpl/readthedokus/images/apple-touch-icon.png HTTP/1.1", host: "site.dom.ain", referrer: "https://site.dom.ain/pub/development/rstudio-workbench"

However I cannot say, if these error message are related or already have been there in the previous version.

Any idea? Do you require more information? The system is running on Debian 12 with PHP 8.2

my17560 commented 6 months ago

Hi.

On my computer, the theme is working fine on Kaos.

Could you change to the default theme and see if the TOC appears? If you use plugins, disable them one by one to see if this issue disappears.

If you let me know which plugins you use, I'll test them on my computer.

fthommen commented 5 months ago

The hint regarding the other plugins was good: We are using the Loadskin plugin, as the readthedokus template is only loaded in a specific section of the Wiki. The TOCs show perfectly as long as "readthedokus" is the default template, but as soon as we use "dokuwiki" as default skin and "readthedokus" is only loaded in a specific namespace, there is no TOC any more. There is no similar issue with the other skins I tested.

I cannot say, if this is a problem of Loadskin or ReadTheDokus, but it worked fine until version 2023-08-22

my17560 commented 5 months ago

Thanks for your info. I installed the Loadskin plugin myself and I could confirm the bug. I'll check what's going on.

hr3x8 commented 5 months ago

I'm having the same problem after upgrading to Kaos. I've had the make the following change manually (temporarily) to make it visible:

tpl_parts/tpl_sidebar.html line 8

I had to remove **style="display:none"** I did confirm however that previous version with working sidebar had display:none in the file. Instead of upgrading, I regularly install new instance with new Dokuwiki version, install same (updated) plugins, reconfigure identically to previous version then migrate data and rebuild search index. When looking at source, looks like TOC is build and included in source, but with display:none. There seems to be a lot of code changes in js/readthedokus.js and likely error there. I would suggest that instead of hiding the TOC using display property to not render it in HTML at all.
my17560 commented 5 months ago

I added a workaround not to cause the bug and committed it. Since I haven't officially updated the theme yet, please re-install from the admin menu. If it works, I'll update it officially.

The reason this bug occurs is that the loadskin plugin doesn't return LANG.template variable properly when the ReadtheDokus theme is not the default theme in the configuration. This theme is trying to get the variable and failed. So, it is best to ask the author of Loadskin to return LANG.template variable.

The old version also had the same bug but it occurs AFTER displayed the TOC. I've changed the order of initialization in the new version and the bug occurs BEFORE displaying the TOC, thus TOC is not displayed. I've fixed not to throw an error even if the variable is not available.

fthommen commented 5 months ago

Hello, the patched version works perfectly and shows the TOC again. Thank you very much.

Did you want me to report the issue about LANG.template in the Loadskin plugin bug tracker? However I could only be the messenger and I would not be able to provide more details or do testing, in case there are further questions. It would probably make more sense, if you would report it here.

fthommen commented 5 months ago

I wanted to add: It would be fantastic, if the developers of other plugins were as reactive as you when it comes to fixing bugs. Kudos to you @my17560.

my17560 commented 5 months ago

Thank you very much! Your words motivate me!

About the Load skin plugin, I'll check it a little bit more and report it to the author myself, so you don't need to report the issue.