Zim

Comment 2 for bug 1625977

Revision history for this message
santiago (serware) wrote :

I'm in a hurry and I have programmed a turnaround in the default_with_index template.

In advance warn that I'm a programmer but not a Phyton programmer, and that the template phyton language subset is very restricted.

The turnaround is somewhat tricky because it uses in a tricky way the only function that returns a current page relative uri: resource (maybe there is other function that returns it but I only found this).

The trick consists in get the address of a dummy resource and then replace the part of the address corresponding to the dummy resource by the index one.

To use the turnaorund, in the default_whith_index template replace the code that generates the index link by:

        [% SET indexPage=links.get("index") %]
        [% IF indexPage %]
            [% SET dummyURL=resource("dummy") %]
            [% SET indexURL=dummyURL.replace("_resources/dummy","") %]
            [ <a href='[% indexURL %][% indexPage %].html'>Index</a> ]
        [% ELSE %]
            [ <span class='insen'>Index</span> ]
        [% END %]

Notes:

1. You don't need to have a resources folder with the template name to obtain the dummy relative path
2. Maybe it seems strange to not directly replace the address of the index, but apparently the functions only supports literals.

I attach a test notebook, the default_with_index template renamed as Default_with_index_dummyTrick and modified and generated html where the index links works in all pages.

Santiago