dasBlog and httpfilters

Apparently there is a cool blogging app called dasBlog, which means “That Blog” in German :), that provides a lot of better features when compared with my old blogX, and even better it provides a direct upgrade from blogX, so I don’t have to write my own scripts to do the conversion to what I was going to use (newblog on DNN).

The downside is that I had already written the necessary code to parse and replace … well… “code”… in my blog posts into pretty formatted HTML.

It worked like this… I would type something like

Dim s as New System.Text.StringBuilder 

and it comes out looking like:

.csharpcode
{
font-size: small;
color: black;
font-family: Courier New , Courier, Monospace;
background-color: #ffffff;
/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}

.csharpcode .lnum { color: #606060; }

Dim s as New System.Text.StringBuilder 

So that is pretty cool… but I think I can get the same result, and maybe make it even cleaner, by using an httpfilter.

HttpFilters are registered at application startup and are sent the html just before it gets passed to the browser, so you can use the filters as like a last change modification mechanism. Hopefully I can write some regexps to parse out what I want and replace it with the new stuff.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s