On Tue, Dec 11, 2012 at 10:13 PM, Rui Nibau <rui.ni...@omacronides.com> wrote:
> The 'marks' feature of the firefox plugin is for me a way to store links in
> those pages in the 'bookmarks' namespace, links that are not always relevant
> to keep in the Firefox bookmarks. So, at the end, i want my plugin to be
> able to do the following :
>
> - User choose the notebook to target.
> - User choose the main namespace ('bookmarks') where to store the 'marks'.
> - Click on a toolbar button ; a dialog panel allows me to define link +
> comment that will be written into a defined page into that namespace.
> - Call zim (or zim plugin) to append that text into the defined page (the
> page is created if it not exists).
>
> I could do that without calling zim, dealing with the filesystem myself. I
> can :
>
> (a) read ~/.config/notebooks.list to retrieve notebooks name + uri and
> (b) use Firefox File API to write into an existing document in user's home
> (i.e. writing into a zim notebook).
>
> (a) is already done, as i want to choose which notebook to target, but i
> hesitate to implement (b), because it could be hazardous :

(a) is indeed relatively safe, providing I don't change the way zim
handles these files. Probably I should also implement a "zim
--notebooks" that lists the notebooks just to be future proof.

> * How will react Zim if another app edits or creates pages on an opened
> notebook ? User will have to launch a 'update index' each time ?!

Should be relatively robust, but indeed there can be a few snags.
Especially the case where you update the page the user has open things
may not work so nicely. Index update when zim is (re)started should
detect all changes as well.

This is something I'm meaning to improve in future releases. Want to
use active file monitors to monitor open files and reload when
appropriate.

> * If addon can create a notebook page, it will have to maintain the way Zim
> is writing headers.

Yes, that would be wise. Currently zim regards all text files as
pages, but I'm meaning to change it such that text files without the
header become regular text attachments. (Possibly with the option to
view them in zim as pages without formatting.)

Other things to consider is that notebook layout may become more
flexible in the future, so you would need to call zim to know for sure
the mapping from page name to file name. Also keep in mind that
notebooks may not be mounted, e.g. I have one myself that is on an
encrypted volume that is mounted by the "automount" plugin when zim
starts.

> (1) Create or import a new page.
>
>    usage:
>        zim --import [OPTIONS] NOTEBOOK PAGE
>
>    options:
>        uri=URI             Uri of a page to import / create (if not
> provided, creates an empty page)
>
> (2) Append a content to a notebook page.
>
>    usage:
>        zim --append [OPTIONS] NOTEBOOK PAGE
>
>    options:
>        text=TEXT           Text to append

Will put these on my list for next release. Did include additional
parameters for quicknote in tonight's release. So you could already
release a version of your extension using that version first.

Regards,

Jaap

_______________________________________________
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

Reply via email to