[MKDoc-dev] Change to sub html in flo::editor::Text

Chris Croome chris at webarchitects.co.uk
Sat Sep 25 17:53:43 BST 2004


Hi Charlie

I think you probably wanted this to be on list, perhaps we should
change the reply-to headers for the list...?

On Sun 26-Sep-2004 at 01:59:10AM +1000, Charlie Garrison wrote:
> Good morning,
> 
> On 25/9/04 at 11:24 AM +0100, Chris Croome <chris at webarchitects.co.uk> wrote:
> 
> >In the past I think there was a template for the formatting of all
> >components, including the text and html ones and in this template I
> >wrapped the components in <div>'s with "text" and "html" classes to
> >make the manipulation of these components easier with CSS.
> 
> I like that idea. I always like having plenty of tags with class attributes to
> make using CSS easier.
> 
> >I suspect that this code was added due to my complaining about too
> >many unnesessary (unnecessary from a XHTML / CSS point of view) div
> >tags being generated, and then it wasn't fixed after the
> >class="text" was added.
> 
> After looking at the code a bit more, that sounds right.
> 
> >Um, what does the output look like? I find it handy to have each
> >component wrapped in a div or span with a class set to the component
> >type but this is only for CSS styling and not for any other reason.
> 
> There were two outer divs, one without any attributes and one with
> class="text" attribute. Since both text and html components are handled the
> same way, I had a look at the html editor module. Using that as a guide, I've
> got the text component working 'the right way' (only one outer div, with class
> attribute).
> 
> >> Being new to this list, what is the best way to submit this as a
> >> bug/fix?
> >
> >I think for the moment sending patches to this list is OK, and as
> >things start to settle down we can start to give out cvs access to
> >people as it's needed.
> >
> >We should probably set up a MKDoc-cvs-commits list and email all
> >commits there, we could also have a bot notify the #mkdoc irc
> >channel also :-)
> 
> Well for now, here are the revised subs in flo/editor/Text.pm:
> 
> sub html
> {
>     my $self = shift;
>     my $data = $self->{'data'};
>     $data = MKDoc::Text::Structured::process ($data);
>     
>     my @link = flo::Editor->links();
>     my @newl = ();
>     for (@link) {
>         my $new = { %{$_} };
>         $new->{_expr} = delete $new->{expr};
>         $new->{_tag}  = 'a';
>         $new->{title} = delete $new->{desc};
>         push @newl, $new;
>     }
> 
>     return MKDoc::XML::Tagger->process_data ($data, @newl);
> }
> 
> sub as_xhtml { return "<div class=\"text\">" . shift()->html() . "</div>" }


Great! I'll get this applied on Monday morning (no cvs commits can
be done from outside our office at the moment).

Thanks for this :-)

Chris


-- 
Chris Croome                               <chris at webarchitects.co.uk>
web design                             http://www.webarchitects.co.uk/ 
web content management                               http://mkdoc.com/   


More information about the MKDoc-dev mailing list