Re: [Zim-wiki] Zim 0.75.2 released!

2023-07-09 Thread Johan Vromans
On Fri, 7 Jul 2023 20:53:34 +0200, Jaap Karssenberg
 wrote:

> Zim 0.75.2 has just been released. This update contains all the
> incremental updates over the past 3/4 of a year.

I run zim from the git (been doing that for years). After pulling 0.75.2, I
get load errors:

AttributeError: module 'inspect' has no attribute 'getargspec'
ERROR: Exception while loading plugin: sourceview

Did I overlook something?

-- Johan

___
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


Re: [Zim-wiki] Using Zim as document editor

2023-01-21 Thread Johan Vromans
On Sat, 21 Jan 2023 12:27:12 -0500, Joseph Reagle 
wrote:

> Hi Johan, FYI: there's been a long-standing issue for Zim to move to the
> markdown format,

While interesting, it is not related to this thread.

> Do you mean Zim regularly polls the files (via something like
> `os.path.getmtime(path)`) within the Zim folder?

Good point. AFAICS zim does not use polling or timestamps. When you open a
page it is always reloaded. When the page is (temporarily/permanently)
closed zim checks does clash detection.

This means that my current PoC already works except for clash detection.

-- Johan

___
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


Re: [Zim-wiki] Using Zim as document editor

2023-01-21 Thread Johan Vromans
On Sat, 21 Jan 2023 15:26:23 +, Jack  wrote:

> I have no idea, but wonder whether it is possible to create a new zim
> document and then pour the contents of the old one into it.

The problem is that when the alien document changes, there is no way to
update the corresponding zim document. Both zim and the other tools are
unaware of wach other.

-- Johan

___
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


Re: [Zim-wiki] Using Zim as document editor

2023-01-21 Thread Johan Vromans
On Fri, 20 Jan 2023 20:43:02 +0100, Johan Vromans 
wrote:

> However, before a page is loaded, there is also a call to readLine but I
> haven't quite found out who does the call, and why. Is it some kind of
> peek at the document to see if it is a zim document?

I now have a PoC implementation that uses additional zim headers.

Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.6
Zim-Load: convert-to-zim mydocument.json
Zim-Store: convert-from-zim --output mydocument.json
Creation-Date: 2023-01-20T21:11:50+01:00

While this works nice for transparently loading/storing of alien documents
there's still one important feature missing: zim uses the timestamp of the
zim document to detect external changes and this timestamp is not updated
when external tools modify the alien document.

An alternative approach is to use a fuse filesystem that transparently
converts documents from alien to zim format and vice versa. A bit like
using a cannon to kill a gnat...

Suggestions?

-- Johan

___
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


Re: [Zim-wiki] Using Zim as document editor

2023-01-20 Thread Johan Vromans
On Thu, 5 Jan 2023 13:04:07 +0100, Johan Vromans wrote:

> What I would like to have is a load and store hook where I can perform the
> conversions. I want the file on disk to be in the 'alien' format, while
> zim only 'sees' zim format.

Looking at the code I see that Zim uses readLines (in newfs.local) to fetch
an page. This looks a good place to intercept and silently convert
the document from alien into zim format, so that zim only sees zim
documents.

However, before a page is loaded, there is also a call to readLine but I
haven't quite found out who does the call, and why. Is it some kind of peek
at the document to see if it is a zim document?

-- Johan

___
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


Re: [Zim-wiki] Using Zim as document editor

2023-01-05 Thread Johan Vromans
Hoi Jaap,

On Thu, 5 Jan 2023 11:23:11 +0100, Jaap Karssenberg wrote:

> The workflow basically relies on "covert xyz --> zim, edit zim, convert
> zim --> xyz". Obviously, the bottleneck is the accuracy of the converter
> to reproduce the original content as close as possible and reflect the
> edits properly.

Actually, that is not the problem. Or, shall I say, that is easy for me to
solve.

What I would like to have is a load and store hook where I can perform the
conversions. I want the file on disk to be in the 'alien' format, while zim
only 'sees' zim format.

I haven't studied the code yet, maybe you have a pointer where to look?

-- Johan

___
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


Re: [Zim-wiki] Using Zim as document editor

2023-01-02 Thread Johan Vromans
On Mon, 2 Jan 2023 13:01:38 -0500, Little Girl 
wrote:

> That should be under your control with the custom command you decide
> to use. If I'm understanding the purpose of the Custom Tools interface
> correctly, it's just an internal interface that lets you run commands
> from within Zim that you would have to run elsewhere otherwise.

I did some experiments and it seems that this is not a viable approach.
One of the reasons is that Zim does not recognize wiki markup when
receiving data from the custom tool. 

For example a simple 'cat' filter, run on

aaa
bbb<- this line is bold
ccc<- this line is italic
ddd

turns the content into

aaa
**bbb**
//ccc//
ddd

which is clearly not desired.

I think what I would need is something more powerful, i.e. load/store hooks.

-- Johan

___
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


Re: [Zim-wiki] Using Zim as document editor

2023-01-02 Thread Johan Vromans
On Mon, 2 Jan 2023 07:49:16 -0500, Little Girl 
wrote:

> I haven't tried it, but this should be possible with the Custom Tools
> option inside the Tools menu.

Thanks for the suggestion. As far as I can see this will allow installing
commands that modify (parts of) the current contents. While this could be
used for my purposes, it would require manual intervention before/after
each load/save which man quickly lead to mistakes.

Also, the physical file on disk should be in the 'alien' format since it is
used and updated by other tools as well.

-- Johan

___
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


[Zim-wiki] Using Zim as document editor

2023-01-02 Thread Johan Vromans
Hi all,

Best wishes for 2023!

I was wondering... Would it be possible to use Zim as an editor for
documents that are not Zim notes.

For example, when I open a particular document, instead of reading it from
disk Zim would run a plugin or an external tool to fetch the actual
contents. Likewise, when the document is saved, some other plugin/tool is
run to write the contents to disk.

Rationale is that I have quite a few markdown or json documents that I
would love to be able to maintain with a decent tool like Zim.

-- Johan

___
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


Re: [Zim-wiki] Zim plugins: Terminal

2020-10-31 Thread Johan Vromans
On Sat, 31 Oct 2020 18:42:43 +0100, Thomas Engel 
wrote:

> Are there any errors when running zim in debug-mode (zim --debug)?

There seems to be something wrong with line 186.

  self.terminalview.feed_child(CLEAR_COMMAND, len(CLEAR_COMMAND))

TypeError: Vte.Terminal.feed_child() takes exactly 2 arguments (3 given)

When I remove the 2nd arg, which should be legal, it yields:

TypeError: Item 0: Must be number, not str

I can't explain...

When I uncomment the line I do indeed get the terminal window and
everything seems to function fine.

Suggestions:

- display the current path in the title (it now reads "Terminal", not very
  useful).

- a keyboard shortcut to close and (re)open the terminal window

- a keyboard shortcut to switch focus to/from the terminal window

Good job!

-- Johan

___
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


Re: [Zim-wiki] Zim plugins: Terminal

2020-10-31 Thread Johan Vromans
On Sat, 31 Oct 2020 13:00:58 +0100, Thomas Engel 
wrote:

> i've created a plugin (see
> https://github.com/datenwurm/zim-plugin-terminal) which adds a terminal
> pane.

Sounds nice... I can enable the plugin, configure it, but I do not see a
terminal window...?

Zim 0.73.3 on Fedora 31.

-- Johan

___
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


Re: [Zim-wiki] Zim VS Android

2020-08-10 Thread Johan Vromans
On Mon, 10 Aug 2020 15:41:34 +0200, D  wrote:

> Not that I know of, but there's an opportunity to implement this in Markor
> , as the developer
> mentioned it here
> .

Interesting... The fact that the author is aware of the zim-wiki format is
promising.

___
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


[Zim-wiki] Parse tree and metadata

2020-07-09 Thread Johan Vromans
When I convert (dump) the parse tree of a page with metadata:

cat page.txt | python -m zim.formats wiki > foo.xml

then the metadata comes out as a leading text paragraph, e.g.

Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.6
Template: Bar


Shouldn't this be parsed, e.g.


text/x-zim-wiki
zim 0.6
Bar


or something similar?

-- Johan

___
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


Re: [Zim-wiki] Export templates

2020-07-07 Thread Johan Vromans
On Tue, 7 Jul 2020 19:54:32 +0200, Jaap Karssenberg
 wrote:

> My guess would be that

Your guess? I thought you programmed it :)

> 
>[% IF page.meta.get("Templat") %]
> 
> is what you are looking for. The "meta" attribute is a dict, not "page".

This yields: AssertionError: Not a valid function: page.meta.get .

Besides, the reference to page.meta already gives warnings if there's no
metadata (as is the case for most of my pages).

-- Johan

___
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


Re: [Zim-wiki] Export templates

2020-07-07 Thread Johan Vromans
On Tue, 7 Jul 2020 18:57:21 +0200, Jaap Karssenberg
 wrote:

> Yes the template syntax should support the python "get" function.

And how is this supposed to work?

[% FOR page IN pages %]
[% IF page.get("meta") %]

yields AssertionError: Not a valid function: page.get
TypeError: 'PageProxy' object is not subscriptable

-- Johan

___
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


Re: [Zim-wiki] Export templates

2020-07-07 Thread Johan Vromans
> Not really, but you could construct a template that is one big "if ...
> else ..." and includes the two templates.

To select the appropriate template I'd like to use a meta setting,
something similar to:

Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Template: foo

And in the template:

[% IF page.meta.Template == "Foo" %] ... [% END %]

Technically this works, but generates an awful amount of warnings.
I couldn't find a way to test whether a page has a meta, and whether this
meta has the key.

Did I miss a hidden equivalent to the python 'key in dict' test?


___
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


Re: [Zim-wiki] Export templates

2020-07-07 Thread Johan Vromans
On Tue, 7 Jul 2020 12:18:32 +0200, Jaap Karssenberg
 wrote:

> Not really, but you could construct a template that is one big "if ...
> else ..." and includes the two templates.

Hmmm. I get

TODO also allow files from template resources

(both master and develop branch)

___
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


[Zim-wiki] Export templates

2020-07-06 Thread Johan Vromans
I'm trying to export a web site from Zim. However, some of the documents
(pages) need a different template.

Is it possible to select different templates for different documents?

-- Johan

___
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


Re: [Zim-wiki] Zim 0.73 released !

2020-06-06 Thread Johan Vromans
Good job, congratulations!

With so many features, robustness and happy users, why not leave the
experimental 0.* phase and call it 1.0...?

___
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