[Clipart] upload script suggestion

Jonadab the Unsightly One jonadab at bright.net
Fri Mar 25 20:25:24 PST 2005


"Stephen Silver" <ocalocal at btinternet.com> writes:

>> > If we have to, we have to, but I suspect it's not necessary.
>
> I think it's necessary, because the regular expressions will always
> be fooled in some situations.  For example, these two files in the
> incoming folder still have Adobe Illustrator metadata, because the
> regular expression didn't notice it, and they have no OCAL metadata,
> because the regular expression couldn't find a place to put it:
>
>  horse_1_konstantin_r._01.svg
>  horse_2_konstantin_r._01.svg

The Illustrator metadata's still being there would be tolerable.

Obviously, the loss of the metadata specified at upload is more
problematic.  I inspected one of these files, and discovered the
reason:  it does not have a closing </svg> tag, because it prefixes a
namespace.  I can work around this (err, fix checked in), but...

>> I'm not sure meta-metadata will ever occur in practice,
>
> It occurs in horse_2_konstantin_r._01.svg.

Oh.  Hmmm.   To work around that I need Perl6 regular expressions.
Failing that, we may indeed have to go to an XML parser.  Se la vi.

>> Although, if there were an XML equivalent for HTML::Tree (with its
>> nifty look_down method), that would make it more reasonably doable.
>
> It only takes a few lines in Andrew Archibald's Python script to walk
> the XML tree.  I don't think it can be that much harder in Perl.

No, but it's harder than a two-character regex tweak.  Ah, well.
Guess it's time to grok XML::Twig...

-- 
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,"ten.thgirb\@badanoj$/ --";$\=$ ;-> ();print$/




More information about the clipart mailing list