GNU Source Hightlight Patch

Tue, Dec 9, 2003 with tags code

GNU Source Highlight is a nice little piece of software that makes it easy to highlight the code that I might want to include in my blog. It doesn’t work for everything, but works well enough and tends to generate prettier output than VIM does. However, it doesn’t quote element attributes and therefore does not generate valid HTML. Here is a patch for it that makes it properly quote attributes:

--- src/genhtml/htmldecorator.cc.orig   Tue Dec  9 22:53:27 2003
+++ src/genhtml/htmldecorator.cc    Tue Dec  9 22:53:55 2003
@@ -55,7 +55,7 @@
 void
 TagDecorator::generateAttrVal() const
 {
-  (*sout) << " " << attr << "=" << val ;
+  (*sout) << " " << attr << "=\"" << val << "\"";
 }

 void