[Sputnik-list] Directory pages

Yuri Takhteyev yuri at sims.berkeley.edu
Thu Feb 7 01:45:41 GMT+2 2008


>  I tried but it failed in a versium error. Do you know what would be
>  the best way to escape the slash in the page name in versium so that
>  it doesn't get interpreted as a directory seperator ? Below is the
>  error I got.

I am sorry for the slow response.

Now it's officially a bug in Versium.  I suppose that there are two
options that would be reasonable when the user asks to save a node
named "foo/bar" : escape the slash (save it as wiki-data/foo%2Fbar) or
make a directory "foo" and a subdirectory "bar".  The second approach
is less ugly, but might create problems if you later use certain page
names.  E.g., if you create a page foo/00001 it would correspond to
wiki-data/foo/000001, which is the file that stores the initial
version of "foo".  With the first approach, "foo/000001" would simply
be saved as wiki-data/foo%2Fbar with no conflicts with the "foo" page.

What do you think would be better?

Either way, I will try to release a new version of Versium soon, so if
anyone else got any requests for small fixes, now is a good  time.

Meanwhile, if you want a quick fix to this problem (along the lines of
option 1), then just add an extra gsub to Versium:escape_id() and
Versium:unescape_id() in versium.lua:

In

    function Versium:escape_id(id)
       assert(id and id:len() > 0)
       return string.gsub(id, ":", "%%3A")
    end

change

       return string.gsub(id, ":", "%%3A")

to

       id = string.gsub(id, ":", "%%3A")
       return string.gsub(id, "/", "%%2F")

- yuri

-- 
http://sputnik.freewisdom.org/



More information about the Sputnik-list mailing list