Quantcast
Channel: Workarounds – no dogma blog
Viewing all articles
Browse latest Browse all 9

Dotclear blog editing problem

$
0
0

The dotclear blogging engine has some issues when including pre-formated html; it removes all leading spaces and mangles empty lines.

This is a significant problem when posting nicely coloured code snippets like those produced by hilite.me or the SyntaxHilighter in WordPress.

A small hello world app ends up looking like this –

public class Hello1
{
public static void Main()
{
System.Console.WriteLine("Hello, World!");
}
}

Instead of this –

public class Hello1
{
   public static void Main()
   {
      System.Console.WriteLine("Hello, World!");
   }
}

Ahhh, much more readable. My way of solving this requires sed, so you’ll need a Linux installation, cygwin or Windows version of the command.

My hilite.me CSS looks like this –
border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;font-size:9px

Create a file called SedFixesForDotclear.sed.
Its content is

s/^$/<br/>/g #replace blank lines with <br/>
s/t/    /g #replace tabs with spaces - then the next line replaces the spaces
:l s/^((&nbsp)*) /1&nbsp/;tl #replace all leading spaces with &nbsp

Run the command –
sed -f SedFixesForDotclear.sed input.html > output.html

Paste the output file into your post.


Viewing all articles
Browse latest Browse all 9

Trending Articles