http://qs1969.pair.com?node_id=311475

SavannahLion has asked for the wisdom of the Perl Monks concerning the following question:

I've been searching around for a similar sample to jeffas' example of Perl::Tidy code snippet. So I figured, what the hell, let's try a search on ctidy and I came up with a mishmash of pages with a vague reference to jtidy. Which, isn't quite what I was looking for, I think. :(

I'm hoping to find something that will at least do something similar to the example jeffa gave for other languages such as Visual Basic and C/C++. I see a number of web pages that correctly color code things like VB. I'm wondering if there is such a module available. At a minimum, it would be nice to feed source code into a parser and get back HTML code that can be color coordinated via css files.

I tried ctidy and vbtidy and they seem to be out. Then I tried other combinations and variations of VB, C/C++, highlighting, Perl, syntax, keyword searches as well and I generally get back foreign pages or pages to code editors.

I'd be happy with a hint for searching. :-S

Is it fair to stick a link to my site here?

Thanks for you patience.

Replies are listed 'Best First'.
Re: Tidy code for other languages?
by thospel (Hermit) on Dec 02, 2003 at 02:26 UTC
Re: Tidy code for other languages?
by Roger (Parson) on Dec 02, 2003 at 01:22 UTC
    You could try to use a colour highlighting editor - such as ConText I am using. Open VB, C/C++, Perl, Java, ... in the editor, and then export to HTML with colour syntaxing ... if you are working under Windows of course.

    Or ... you could ask Steve Hancock nicely if he could add some extensions/variants to his Perl::Tidy, so that other languages could be supported as well. Perhaps something like -

    supertidy -html -language VB -langdef VB.def -css=VB.css ...
Re: Tidy code for other languages?
by Theo (Priest) on Dec 02, 2003 at 15:56 UTC
    Site links can be place in your home node. I don't know how the Monastery views links to your personal web pages in writeups, but I don't have a problem with it. (FWIW)

    -theo-
    (so many nodes and so little time ... )

      I had to re-read your node more than once before I figured out what you were talking about :p
      I stuck that in my sig' since I wasn't sure if local mores permitted a link to a Wiki site.

      Anyhow, I've been looking over the C specific beautifiers and it appears that, while they do what I want, they're not written in Perl so I can't really plug them into where I want them to be used. So far, the most promising ones turned out to be executables and/or something that's native to the language they're cleaning up.
      Of course, I haven't had a chance to examine every last link I found so I'll come back later once I go through them all.

      Is it fair to stick a link to my site here?

      Thanks for you patience.

        I don't think there's any kind of policy about linking to sites, except maybe that you might get a frown or a few dozen if the plug is way obnoxious. A simple unobtrusive link will probably be politely ignored by the majority.

        Makeshifts last the longest.