lggruspe / slipbox

A static site generator for Zettelkasten notes
https://lggruspe.github.io/slipbox
MIT License
57 stars 5 forks source link

Slipbox main list don't display, big number problem with li value ? #13

Closed reyman closed 2 years ago

reyman commented 2 years ago

Hi, I'm trying to use slipbox with my ZK timestamp based UUID (ex 20211011140846 for 2021-10-11-...), but i everything goes well on navigation with big number, the main menu (index.html) is blank not displayed.

Here the result of my index.html with no errors after build :

<main>
<section id="home" class="level1" title="Home">
<h1>Slipbox</h1>
<ol class="slipbox-list">
<li value='20211011140846'></li>
<li value='20211011142113'></li>
</ol>
</section>

<section id="20211011140846" class="level1 slipbox-note" data-filename="20211011140846.md" title="GT Notebook">
<h1>GT Notebook</h1>
<p>Réflexion sur l’objet Notebook</p>
<ul>
<li><a href="20211011142113">Notebook &amp; Constructivisme</a> Notebook &amp; Constructivisme</li>
</ul>
</section>
<section id="20211011142113" class="level1 slipbox-note" data-filename="20211011142113.md" title="Notebook &amp; Constructivisme">
<h1>Notebook &amp; Constructivisme</h1>
...

The number appear then disapear, probably linked to this 404 :

Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
127.0.0.1 - - [11/Oct/2021 18:49:46] "GET /public/ HTTP/1.1" 200 -
127.0.0.1 - - [11/Oct/2021 18:49:47] code 404, message File not found
127.0.0.1 - - [11/Oct/2021 18:49:47] "GET /usr/share/javascript/mathjax/tex-mml-chtml.js HTTP/1.1" 404 -
127.0.0.1 - - [11/Oct/2021 18:49:47] "GET /public/app.js HTTP/1.1" 304 -
127.0.0.1 - - [11/Oct/2021 18:49:47] "GET /public/graph/data.json HTTP/1.1" 304 -
reyman commented 2 years ago

@lggruspe Our website is now online so you could see the problem directly on the main page here : https://gt-notebook.gitpages.huma-num.fr/wiki/#home

I don't know how li is linked with section using css or js but the probleme is probably here, a problem of ranking of timestamp used as value ? ...

Moving from <ol> to <ul> probably solve the problem

Edit : That doesn't solve the problem. I change all ol to ul in the html using regex, without change.

lggruspe commented 2 years ago

<li> elements don't seem to work with very large values. I'm guessing the value has to fit in a javascript number.

The solution is probably to not to use <li>s to display links.

lggruspe commented 2 years ago

the 404 I think is a different problem.

reyman commented 2 years ago

<li> elements don't seem to work with very large values. I'm guessing the value has to fit in a javascript number.

The solution is probably to not to use <li>s to display links.

I search a little and i cannot found the js part that manage link between "section number" and "li value" ? If you remove li value how do you build the main page ?

In the future do you patch this in the current code or i need to fork because this is too specific to our case ?

lggruspe commented 2 years ago

It's a bug and it needs to be fixed here. The relevant code is in https://github.com/lggruspe/slipbox/blob/master/js/src/list.js and https://github.com/lggruspe/slipbox/blob/master/slipbox/page.py.

The generated index.html actually already contains the <li> elements with the note IDs as values. The <ol> elements are rendered in page.py (look for slipbox-list).

All list.js does is to get the note titles from the DOM (section.slipbox-note elements) and to copy the title into the <li> elements.

lggruspe commented 2 years ago

It should be fixed now in the newest commit. a31eea8

reyman commented 2 years ago

It should be fixed now in the newest commit. a31eea8

Great ! I test ASAP !

reyman commented 2 years ago

@lggruspe Is it possible to push a new release on pipy to test ? Thx

lggruspe commented 2 years ago

It's been uploaded.

Note: you may have to delete the .slipbox folder and to reinitalize with slipbox init.

reyman commented 2 years ago

It works, thanks @lggruspe : https://gt-notebook.gitpages.huma-num.fr/wiki/#home I wrap slipbox into another application because people on the project write using [[]] wikilinks (using obsidian and zetlr). So i convert [[]] into .md to []() using regex before running slipbox. i also retrieve dynamicaly a zotero .bib from a group before compilation by slipbox.