Re: [Zim-wiki] Hidden text (resend)

2012-11-01 Thread Jaap Karssenberg
On Wed, Oct 31, 2012 at 5:00 PM, Fred McDavid  wrote:
> I think it'll make it easier to write plugins that can extend the wiki
> syntax.

Not sure if I would want plugins to extend the syntax. Afraid that
that may be a sure way to cause incompatibilities. (Although I do
foresee plugins adding new syntaxes, e.g. to support native support
for markdown, retext etc.)

What I do plan -- as soon as I manage to free up my agenda :S -- is to
implement inline objects that plugins can use to add functionality.
Basically this will allow embedding arbitrary widgets in the page and
have the underlying data stored as an embedded block with it's own
syntax. This is what is being worked at in pyzim-next.

> I'l have a look at the pyzim-next branch.

Please do. It already has a plugin that can deal with inline code
blocks by embedding a gtksourceview. It still has some rough edges,
but may do already what you want to implement.

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


Re: [Zim-wiki] Hidden text (resend)

2012-10-31 Thread Fred McDavid
in the Dumper class, there's a dump_children method that loops thru 
elements and recursively calls itself in a way that (I think) precludes 
adding elements via the plugin mechanism.


I've been trying to pull this out of the loop:

elif element.tag == 'h':
level = int(element.attrib['level'])
if level < 1:   level = 1
elif level > 5: level = 5
tag = '='*(7 - level)
output.append(tag+' '+element.text+' '+tag)

and replace it with

def 
element_dumper_h(dumper,element,list,output,list_level=-1,list_type=None,list_iter='0'):

level = int(element.attrib['level'])
if level < 1:   level = 1
elif level > 5: level = 5
tag = '='*(7 - level)
output.append(tag+' '+element.text+' '+tag)
DumperClass.registerElementDumper( 'h', element_dumper_h )

I think it'll make it easier to write plugins that can extend the wiki 
syntax.


I'l have a look at the pyzim-next branch.

Regards,

--Fred

On 2012-10-31 10:49, Jaap Karssenberg wrote:
On Wed, Oct 31, 2012 at 3:33 PM, Fred McDavid  
wrote:
I did a little work on a plugin to hilite code snippets but hit a 
wall with
non-pluggable tags that I think is the same that would prevent such 
hidden

info.

I did a little hacking on the Dumper class in zim/formats/wiki.py to 
make

tags pluggable, but so far it's not much to look at.

Jaap, do you have any plans to make this possible?  If not, would 
you mind

if I took a stab at it (while sometimes asking for help)?


I'm sorry, but a lost you at "non-pluggable tags". Afraid I don't 
have

clue what you mean by that.

As a general comment, if you are hacking on the parser and dumper
classes, please use the "pyzim-next" branch.

Regards,

Jaap


--
Fred McDavid
founder, LandMetrics
f...@landmetrics.com
540.300.5263

--
Fred McDavid
founder, LandMetrics
f...@landmetrics.com
540.300.5263

___
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