zim-wiki team mailing list archive
Mailing list archive
Re: new wiki syntax: better way to implement in Zim ?
On Sun, Jan 23, 2011 at 2:50 PM, Rui Nibau <rui.nibau@xxxxxxxxxxxxxxx> wrote:
> So Jaap, my question is : **how can i tell Zim to use my wiki format to
> read / write notebook files** ? Well, i understand how to do it, as my
> (local) branch of Zim now works with the new wiki syntax ; the real
> question is : **which is - in your opinion - the best way to do it** ?
> By now, i run Zim with a command line argument, i.e :
> ./zim.py --wiki-syntax=mywiki
> The default syntax still 'wiki', and the value is stored in a
> WIKI_SYNTAX property in zim module ; next, i clear the 'optsdict' in the
> main method if the argument is present, update the WIKI_SYNTAX property
> and use it everywhere in the code where there is a call for the format -
> i.e. get_format('wiki') became get_format(zim.WIKI_SYNTAX).
I think this should be a notebook property, as different notebooks may
have different default syntax. As such it could be in the notebook
properties dialog. Using a commandline option is not really the right
way, because that would not work when zim is called e.g. from the
desktop application menu. As for coding style I would not use a
parameter WIKI_SYNTAX in all capitals as that suggests a constant,
while in this case this will be a configuration parameter.
To make things more complicated you might want to think about pages
that do not follow the default. The zim text files have a heading that
gives the wiki format. Ideally for other formats these headings should
still be there but now tell the notebook what alternative syntax they
use. THis would mean the default syntax is only used explicitly when
creating a new page.
However I realize that having these headers may conflict with the
existing wiki implementation with which you want to interface. For now
it will work to just use the default when no headers are present.
However the discussion in this bug report may change that :
So apart from a module for parsing the format you may also need to
subclass the store/files.py module to fine tune it for your specific
If you put the code you have so far in launchpad we can discuss more
specific how to implement this.