At work we use mnoGoSearch to handle our sitewide search engine needs. It’s a pretty powerful and flexible tool, but has a couple annoyances:
- The documentation is uneven at best.
- Out of the box, the app can’t generate valid XHTML.
The second one is what was annoying me today, because even after you clean up the example templates, it still insists on mucking up your code. mnoGoSearch seems to rewrite some of the <input> tags is displays, making the “value” attribute uppercase, and forcing a space after every attribute/value combo inside the tag. The latter is problematic because it treats the closing “/” in the <input> tag as an attribute, forcing a space after it. Both of these behaviors ruin my finely tuned XHTML 1.1 transitional-valid code.
So, in a fit of open-source excitement, I decided to patch the code myself. I’m definitely NOT a C programmer, but finding and patching the appropriate code was pretty straightforward. The culprit is the TemplateTag function in the file template.c, which I’ve modified to do the following:
- Write the “value” attribute as lowercase
- place the separating space before the attribute
These changes get it to play nice with XHTML, and shouldn’t affect the search engine’s ability to generate valid HTML.
Since I’m not versed in the ways of diff and patch, I’ll just upload the whole file. It gets interesting around line 335.
Edit: That first version didn’t really work. This one does, though.