← Back to team overview

zim-wiki team mailing list archive

Re: path link checking plugin

 

Hi Nathaniel,

Sorry for responding so late. Afraid that what you try to do can not be
implemented as a pure plugin. You will need to patch the core code of the
pageview to accomplish this.

The reason is that the gtk.TextTag is private within the editor widget. The
parsetree only passes on the content of the page, but indeed does not
contain the widget objects.

So to implement this feature the parsetree needs to be updated to contain a
link attribute whether or not the target exists, plus the widget should be
updated to understand this attribute and render the link differently.

Regards,

Jaap


On Tue, Feb 9, 2016 at 2:48 AM, Nathaniel Beaver <nathanielmbeaver@xxxxxxxxx
> wrote:

> I've written a plugin to check that the target of a file link exists (see
> prototype attached).
>
> However, I'd like to turn the broken links a different color by accessing
> the gtk.TextTag corresponding to the link and changing the style with
> something like
>
> tag.set_property('foreground', 'red')
>
> Unfortunately, I am having some difficulty finding the actual TextTags in
> the parse tree. Right now I am using tree.findall(zim.formats.LINK) to get
> all the links, but the node.tag property is just a string, not a TextTag.
>
> Any suggestions?
>
> Nathaniel Beaver
>
> P.S. Here is the GitHub page if it helps:
>
> https://github.com/nbeaver/zim-pathchecker-plugin
>
> and here is the relevant bug report:
>
> https://bugs.launchpad.net/zim/+bug/1419531
>
> _______________________________________________
> Mailing list: https://launchpad.net/~zim-wiki
> Post to     : zim-wiki@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~zim-wiki
> More help   : https://help.launchpad.net/ListHelp
>
>

References