← Back to team overview

zim-wiki team mailing list archive

Re: Hidden text (resend)

 

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 <fred@xxxxxxxxxxxxxxx> 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
fred@xxxxxxxxxxxxxxx
540.300.5263

--
Fred McDavid
founder, LandMetrics
fred@xxxxxxxxxxxxxxx
540.300.5263


Follow ups