[Sputnik-list] Directory pages

Jérôme Vuarand jerome.vuarand at gmail.com
Thu Feb 7 02:42:32 GMT+2 2008


2008/2/6, Yuri Takhteyev <yuri at sims.berkeley.edu>:
> >  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?

I think that since Sputnik is logically treating all pages as a flat
list, it's probably better to keep the file system organized the way
it is now, and use escape codes for special characters.

> 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.

On a similar subject, it would be nice to allow having an empty page
name, like what you get with just "?p=" suffix to the url. I did a
local patch on my version that will use the default homepage instead,
but I think the empty-named page would be a better solution. It would
make things more homogeneous if support is added for "directory"
pages, that is pages with a name ending with a slash.

> 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")

I'll try that, but it may take a few days. Anyway as soon as I can
I'll give you feedback.



More information about the Sputnik-list mailing list