Hello,

Note: This mail was edited within a quite long time. Please don't be 
confused if the last part superseeds everything above ;-)

on Sonntag, 14. Oktober 2007, Rajko M. wrote:
> The class="minutes" doesn't break line when is too long.

Known problem, but unfortunately it isn't easy fixable :-(

The wiki doesn't allow <pre class=...>, therefore <div> has to be used.
However, I'm a bit confused. I just read the mediawiki code 
(includes/Sanitizer.php, 10.3 package) and it allows class= for <pre>.
I also confirmed it by testing on a local installation.

OTOH, class= and style= are stripped from the <pre> tag in the openSUSE 
wiki, see http://en.opensuse.org/openSUSE:Sandbox#pre_test
-> needs to be clarified by a wiki admin.


Basically, the <div class="minutes"> uses white-space:pre, which is a 
<pre> with sans-serif (instead of fixed) font.

AFAIK, there's no way to tell CSS "keep line breaks and formatting, but 
break overlong lines" - at least none that is supported by all common 
browsers.

Possible workarounds and fixes are:
- prefix every log line with <br /> (and change the minutes class - in 
  this case it must not behave like <pre>)
  Advantage: compatible with all browsers
  Disadvantage: all lines need to be prefixed with <br /> (can be don
  with sed)
- add linebreaks manually (I sometimes did that)
  Disadvantage: lots of work, and does not match every screen layout
- use white-space:pre-wrap - but this is new in CSS 2.1 and not 
  supported by all browsers out there. [1]
  Disadvantage: If a browser doesn't support it, the line breaks will be 
  lost, which makes the minutes unreadable.
- use some "invalid" CSS hacks for older browsers ([2], untested)

The best solution would be to fix the wiki to allow <pre class=...>.
Reason: we could define a class for <pre> with sans-serif font and 
white-space:pre-wrap, which automatically includes a nice fallback to 
normal <pre> behaviour for older browsers (they would just ignore 
pre-wrap and display long lines).

The CSS code for div.minutes (currently used) is:
div.minutes {
      margin: 0 0 1em 1em;
      padding: 0 .5em;
      color: #000;
      background: #f0f0f4;
      border: 1px solid #669900;
      white-space: pre;
}

pre.minutes would need this code:
pre.minutes {
      margin: 0 0 1em 1em;
      padding: 0 .5em;
      color: #000;
      background: #f0f0f4;
      border: 1px solid #669900; /* all as in div.minutes */
      font:sans-serif; /* or whatever is the default font in the wiki */
      word-wrap:pre-wrap;
}

I don't know how much work is needed on the mediawiki side. However, I 
hope it isn't too difficult because it works on my local 
installation ;-)

Unfortunately, even this solution has a disadvantage: Mediawiki does not 
expand wiki markup inside <pre> and does not allow HTML code, so it 
will be impossible to have a link etc. inside <pre>.
This is a good idea for "normal" <pre> usecases, but bad for meeting 
minutes.

Summary: Every solution sucks. But there are ways that suck less ;-)


Maybe we have to write a plugin supporting a <minutes> tag. Text inside 
this tag should allow wiki markup and be put into a
<pre class='minutes'>. 

Creating such a special tag shouldn't be too hard. Thanks to Google, I 
found a nice explanation:
http://planetozh.com/blog/2006/05/how-to-add-a-custom-function-to-mediawiki/

(some time later)

Out of curiosity, I tried writing the plugin. It turned out to be quite 
easy, the only difficult part was to find out that I had to use the 
recursiveTagParse function to parse wiki tags...

I have attached the proof-of-concept plugin file.
To test/use it, simply save it in the extensions/ directory and add
    include("extensions/minutesTag.php");
to your LocalSettings.php.

In case the admins find my extension usable, I can do some finetuning on 
it (for example nl2br instead of using <pre> to make the linebreak of 
long lines work in every browser).


Regards,

Christian Boltz

[1] http://cthedot.de/xbrowsertest/ws.html

[2]
http://ausreden.sprachwerker.de/2007/02/28/pre-mit-zeilenumbruch-in-wordpress-nutzen/

-- 
> P.S.: Ich habe soeben mutt über Bord geworfen und bin reumütig zu
> evolution zurückgekehrt.
*Waaahhhhh* Ein Abtruenniger!!! Was is los???
[> Ratti und David Haller in suse-linux]

Attachment: minutesTag.php
Description: application/php

Reply via email to