Re: Formatter.pm subclassing troubles

[email protected] (FLoh Leeber) Wed, 19 Apr 2006 08:55:44 +0200
Newsgroups perl.kwiki
Message-ID <[email protected]>
Hi!

Thanks fot the answer. I partially disagree, since the 
"Spoon::Formatter:..."-Classes in the beginning would work then either. 
I think the prefix permits kind of shortcuts for the classnames, but 
when a full classname is given, then it isn´t prefixed.
I´ve gone through the code with the debugger, and in my opinion the 
resulting "table"-array looks correct, that is, every 
"formatter_id"-entry has the correct classname associated, even my 
extension.

However, I tried to modify the Kwiki::Formatter-class, and just copied 
an entry (what should be the lightest modification possible) and 
modified the regex. Still no luck. 
http://www.kwiki.org/?KwikiFormatterModule refers only to overriding an 
existing format rule, which I do not want to do.

kind regards, FL

Kang-min Liu schrieb:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> On Apr 19, 2006, at 7:28 AM, FLoh Leeber wrote:
>
>> sub formatter_classes {
>> qw(
>> Spoon::Formatter::WaflPhrase
>> Spoon::Formatter::WaflBlock
>> HSF::Formatter::UserID
>> Heading Paragraph Preformatted Comment
>> Strong Ulist Olist Item Table TableRow TableCell
>> Line Emphasize Underline Delete Inline MDash NDash Asis
>> HyperLink TitledHyperLink TitledMailLink MailLink
>> ForcedLink TitledWikiLink WikiLink
>> );
>> }
>
>
> Hi there,
>
> Although you give 'HSF::Formatter::UserID' in here, but Kwiki::Formatter
> these classes are prefixed with 'Kwiki::Formatter::', which is defined
> earlier in the code by:
>
>   const class_prefix => 'Kwiki::Formatter::';
>
> That's the reason it's not working for you.
>
> IMHO, for your purpose,instead of sub-classing everything,
> you could just define a Kwiki::Formatter::UserID method and
> use hook to change the return value of formatter_classes.
>
> Cheers,
> Kang-min Liu
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (Darwin)
>
> iD8DBQFERZoZCSIfi0PaMDQRAiu+AJ9tPeDyOldO7sbnalRkMoXHm39VcgCeMuJ3
> xnsd4u27mAQmoW2uuN7YwJs=
> =o0rF
> -----END PGP SIGNATURE-----


-- 
FLoh

"don_schaefer: ne brauchst keine isomatte mitbringen du kannst 
auf den boden schlafen"