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

Chris Croome chris at webarchitects.co.uk
Sat Sep 25 11:24:47 BST 2004


Hi it's great to see someone delving into the code :-)

On Sat 25-Sep-2004 at 06:22:20PM +1000, Charlie Garrison wrote:
> After a bit of digging I found the sub 'html' in flo::editor::Text
> which wraps the formatted text in div elements:
>     $data = "<div class=\"text\">$data</div>";

Ah, this was probably one of the last changes that Jean-Michel made
before he quit.

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.

Then there were some code changes and the text and html component no
longer had their own templates and the classes were lost.

I then asked Jean-Michel to add them back in and I guess this bug
crept in when this happened.

> And then after formatting/substituting links, strips outer div elements:
>     $res =~ s/^<div>//;
>     $res =~ s/<\/div>$//;
> The above code strips the trailing div, leaving unbalanced tags. The
> obvious quick fix is to comment the two lines above. But why are those
> div tags being stripped, do I need to look for a deeper problem? 

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.

> Should
> the code be changed to something like:
>     $res =~ s/^<div.*?>//;
>     $res =~ s/<\/div>$//;
> Or even:
>     $res =~ s/^<div>//  and  
>     $res =~ s/<\/div>$//;
> Anyway, pages with text components are working fine now, with those
> lines commented. Should I be stripping the divs instead?

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.

> 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 :-)

All the best


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