views:

27

answers:

2

Looking to format (automated, in application) some html / nvelocity templates. Tidy seems to be the answer for this, however all the .Net ports seem to be problematic and not very well maintained. Most rely on unmanaged code under the covers and that starts imposing other restrictions on the project.

For example, to use the code associated with http://www.codeproject.com/KB/mcpp/eftidynet.aspx, the projects now has to be a x86 build.

Is there a new preferred solution for doing this? Or is there a completely managed port of TidyHtml that understands nvelocity or allows custom token definition?

+1  A: 

Let's list them:

  • EfTidy
  • ZetaHtmlTidy (mixed-mode, so it needs different assemblies for x86/x64)
  • tidyfornet (managed assembly but depends on external HTMLTidy native dll)
  • TidyATL (ATL wrapper, old, unmaintained, I think it's also mixed-mode and it even requires COM registration?)
  • TidyNet (fully-managed DLL, no external dependencies)
Mauricio Scheffer
+1  A: 

Even though it's old and unmaintained, I'm using TidyNet because it's fully managed. Does the job just fine.

BTW: Tidy and NVelocity are completely unrelated. I'd never process NVelocity templates with Tidy as it will probably break them... However you might want to run Tidy to the resulting html after processing the NVelocity template.

Mauricio Scheffer
I mention nvelocity, because we are running tidy before running nvelocity, so we are passing certain nvelocity related tokens to tidy for custom handling around those tokens. So they aren't related, but we have to account for those tokens.
Tim Hoolihan
@Tim: I know, that's why I suggested to run Tidy to the resulting html after processing the NVelocity template
Mauricio Scheffer
@Mauricio: unfortunately, that's not an option. The user has to be presented with the template (hence formatted) before the substitutions are made.
Tim Hoolihan