Hi everybody. I worked a couple of hours on Zim code source to deal with a new wiki syntax Parser / Dumper.
The Dokuwiki syntax (used in Zim) is quite good, but i have tons of texts written with my own wiki syntax (inspired by other syntaxes - you can see what it does here - http://omacronides.com/projets/syntaxe-wiki/) and i wanted to use Zim to edit / view those texts. I already have a PHP code that parse and write this kind of syntax, and i adapted it a bit to support some Zim format features (like headers at the beginning of a file). So i was at a point where i can edit a zim notebook with those php tools. The next step was to adapt Zim to be able to deal with files written with my own wiki syntax. My PHP Reader / Writer work quite differently than the wiki Parser and Dumper in Zim ; i didn't try to translate this behavior in python (maybe I'll do that when i have more than a few hours), so i just took the native code (zim.formats.wiki.py) and adapt it with a couple of new regex. 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 read the related bugs / evolutions in launchpad : https://bugs.launchpad.net/zim/+bug/338030 https://bugs.launchpad.net/zim/+bug/495898 https://bugs.launchpad.net/zim/+bug/526034 I saw that maybe alternative syntaxes could be a new feature. So, if you ever think about this evolution, did you think of a way to do it ? Is my way a valid solution ? Or this feature should be managed in a plugin, or with a field in the preference dialog ? As I said, my code is now working, and i could create a branch in launchpad to share the code once a valuable implementation solution is defined. Thanks. -- Rui Nibau Développeur web, rédacteur scientifique email : rui.ni...@omacronides.com jabber: rui.ni...@omacronides.com site : http://omacronides.com pgp : http://omacronides.com/services/pgp-public-key/
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Mailing list: https://launchpad.net/~zim-wiki Post to : zim-wiki@lists.launchpad.net Unsubscribe : https://launchpad.net/~zim-wiki More help : https://help.launchpad.net/ListHelp