Hi Justin,

On Sun, Jun 13, 2010 at 01:59, Justin Vander Ziel <[email protected]> wrote:
[...]
>> It seems that for the input line
>>      [./foobar.jpg]
>> the condition
>>     while regex['img'].search(line) and TAGS['img'] != '[\a]':
>> is never satisfied and instead the while loop gets stuck resulting in an
>> infinite nesting of the image like this
>>         [img[img[./foobar.jpg]]]
>>
[...]
>> The source of the issue seems to be that the Center alignment of an image
>> in TiddlyWiki is the default and yet left and right alignment is supported:
>>         'img'                  : '[img[\a]]'        ,
>>         'imgAlignLeft'         : '[<img[\a]]'       ,
>>         'imgAlignRight'        : '[>img[\a]]'       ,
>>         'imgAlignCenter'       : '[img[\a]]'        ,

Interesting problem!

while regex['img'].search(line) and TAGS['img'] != '[\a]':

The final and TAGS['img'] != '[\a]' part was added to avoid this kind
of infinite loop when the image tag of the target is the same as
txt2tags: [image.jpg]. It's the case for the targets: art, txt, moin,
gwiki, wiki.

But now you bring us a new problem: *part* of the target's image tag
is the same as txt2tags :)

Since txt2tags mark detection is made by regex and not by a
char-by-char parser (now I regret this decision), it is a complicated
problem to solve in a clean way. So I'm doing the dirty way: see r115
in SVN.

I've tested here, adding your image tags to the doku target, and
everything seems ok:

$ echo -e "\n[a.png]\n [a.png]\n[a.png] \n [a.png] "

[a.png]
 [a.png]
[a.png]
 [a.png]

$ echo -e "\n[a.png]\n [a.png]\n[a.png] \n [a.png] " | ./txt2tags -t
doku -H -i- -o-

[img[a.png]]
 [>img[a.png]]
[<img[a.png]]
 [img[a.png]]

Please tell me any problem.
Bye!

-- 
Aurélio | www.aurelio.net | @oreio

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
txt2tags-list mailing list
https://lists.sourceforge.net/lists/listinfo/txt2tags-list

Reply via email to