收录日期:2020/11/26 22:46:54 时间:2010-09-07 20:29:10 标签:formatting,tidy,nvelocity,token

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?

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)

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.