December 2003 - Posts

Okay, I'm pretty solid on the HtmlEditor that I'm going to use for my little side project. It's a sweet editor. Honestly, it has more features than I think are necessary in this case, but that's okay with me.

On to the topic at hand. Originally, I spec'ed the Codify option to be in a dialog because that seemed like a nice tradeoff. I also tried a method that would allow you to either type code into the design surface or copy/paste it from your favorite editor, click a button, and bam! it's formatted. Seems like a winner, but the problem is that when you copy/paste into the editor, you lose tabs/spaces.

So how would you like it to work?

Wow. I realized that I needed some guidance on how to implement the MetaWeblog API and thought, hmm, doesn't that dasBlog jobby do cross-posting with that (api)? Ah, so it does. Ah, and there is some source code to go along with that, thank you.

It doesn't look like I'll be doing anything really “ground-breaking” or “innovative” with my new side project...I'll really just be hacking a few disparate parts together to achieve a goal that I have - and learn more about what I can do with Windows Forms while I'm at it. That's okay with me.

In other news, I finally made use of those commented out settings in my local blog.config for .Text, [host] and [application]. The comment preceding that says, “It is possible to mirror a blog and hard code a specific Host and Application”. Right. I first read this and said, okay, that sounds great. But, what would I use it for?

I've found that setting these two elements lets me run .Text locally, but using the values that the server in question has for its application and host values. So, while I see “http:localhost/dottextweb” the .Text engine sees “http:myinternalserver/thatblog”. Sweet.

ugh. looks like the best way to do this is with [font] tags. eeww.

I just looked at my last post in SharpReader, and it looks like the above attribute replaces the “style” attribute.

So the copy/pasted source, while untabbed, used font tags and ended up in the correct color. The highlighted text just showed up as text, effectively removing the use of syntax highlighting. So, perhaps I should either work out a useage for [font] tags, or maybe just ship a css-level class with the post. Let's see what happens with the class idea.

I finally decided on a name for my project - PostModern. I had already gotten syntax highlighting worked out, but I ended up using a different component than I had originally planned. I'm using a component from SquishyWare called squishySyntaxHighlighter. It's really nice...simple, easy to modify, and it looks pretty spiffy too.

So here's the thing. It creates a little bit of markup by using [span style=] tags where you would expect coloration, so if you're posting any sizeable amount of code, it can get bloated. (That's why I put the second part of the title in there, you nasty nelly you!)

I've found that it's a little bit difficult, if possible at all, to grab the selected text in the HtmlComponent that I'll probably be using, so a drawback of syntax highlighting is that you'll more than likely have to do it from the [html] tab that we're all so familiar with. Also, I've found that the HtmlComponent (and others too, so it must be a mshtml thing) will colorize text pasted from Visual Studio. Here's the difference:

[pasted directly into the design surface]
using System;

namespace

HighlightTest

{

///

/// Summary description for SampleCs.

///

public class SampleCs

{

public SampleCs()

{

//

// TODO: Add constructor logic here

//

}

public void DoSomething( string s ) {

if( s == "string literal" ) {

return;

}

}

#region

This is a Region

private void DoSomethingElse( int i ) {

int x = i;

}

#endregion

}

}

 [using the SyntaxHighlighter]

1using System;
2
3namespace HighlightTest
4{
5	/// 
6	/// Summary description for SampleCs.
7	/// 
8	public class SampleCs
9	{
10		public SampleCs()
11		{
12			//
13			// TODO: Add constructor logic here
14			//
15		}
16
17		public void DoSomething( string s ) {
18			if( s == "string literal" ) {
19				return;
20			}
21		}
22
23		#region This is a Region
24		
25		private void DoSomethingElse( int i ) {
26			int x = i;
27		}
28		#endregion
29	}
30}
31

So there's a little bit more work to go thru, but the end result is that it's already formatted the way I like. What do you think about that?

Scott Mitchell told me:

Feature request: you will be my hero if your blog software can display code snippets in a color coding like in VS.NET. And if it's a snap to add such code and have it formatted. (That is, I don't have to do more than just add, [code language="C#"] ... code ... [/code].)

Thanks to Thomas Johansen's  AylarSolutions.Highlight, you're gonna get exactly that!

This was one of the requests that more than one person told me would be nice, so I decided to go ahead and add syntax highlighting to the app b/c yeah it would be nice. Tom's component makes it sickeningly easy to highlight C#, VB.NET, J#, and I believe recently he even added ASPX support.

Initially I was thinking that a 'snippet dialog' would be the easiest way to accomplish this, just insert where the cursor is on the editing surface. Then I thought, well, if I can wrap a font tag around some words that I highlighted, then I should be able to do the same with the syntax highlighting markup, just add a button with a language dropdown to the toolbar, highlight the code you want to show the syntax for, click 'codify' and go!

Now, ScottM is mentioning some custom markup syntax, familiar to anyone who has posted on an online forum. So, you would have a region that you know will look like VS.NET's scheme when it's posted to the blog, but the only visual clue you'll have is the custom markup around the code - it won't be syntax highlighted until you hit the Post & Publish button.

So which would you prefer - from an end user's standpoint? What would make you say, “Yo, that's super easy to add code to my posts“?

See? I'm not the only one.

In my comments here, Michael Slater says I should try out zempt for my blog-editing pleasure...well, I went to the site and thanks for the suggestion, Mikey, but I think that zempt only targets MT, which this blog is not (thank you Jesus...and ScottW:)

So, I've been thinking of what I should name my little side project, and I thought you could help me. I've asked this same question elsewhere, and here's a little list of what has been suggested so far:

  • BlogPost
  • BlogPoster
  • Blogster
  • Hi-Lited-Blog-Poster
  • Poster Face (like poker face:)
  • POSTERIOR
  • Sharlene
  • Sally
  • PostThoughts
  • PostBloggem
  • POST-it (can I get sued for that?)
  • POST-Code
  • POSTAL (as in I'm going)

I was thinking something that included a play on the word post somehow, since that's what I'm calling entries to my blog. Of course, I'm witholding the names of the suggestors to protect my a$. But here's the thing - I just want a fun name for my project, and I think you can help. The above are okay, but fun? I'm not really feelin it. If I can't come up with anything within a day or two, I'm going to cave in and call the finished product Dasha  Post-it. Thanks!

More Posts