pretty-print

Javascript Beautifier

I am looking for a code beautifier that supports javascript and works on both windows and linux and can be used in batch scripts. Any recommendations? ...

Looking for a more flexible tool than GNU indent

When I run indent with various options I want against my source, it does what I want but also messes with the placement of *s in pointer types: -int send_pkt(tpkt_t* pkt, void* opt_data); -void dump(tpkt_t* bp); +int send_pkt(tpkt_t * pkt, void *opt_data); +void dump(tpkt * bp); I know my placement of *s next to the type not t...

how to pretty print xml from Java

I have a Java String that contains XML, with no line feeds and indentations. I would like to turn in into a String with nicely formatted XML. How do I do this? String unformattedXml = "<tag><nested>hello</nested></tag>"; String formattedXml = new [UnknownClass]().format(unformattedXml); Note: My input is a String. My output is a Strin...

Java: Writing a DOM to an XML file (formatting issues)

I'm using org.w3c XML API to open an existing XML file. I'm removing some nodes , and I'm adding others instead . The problem is that the new nodes that are added are written one after another , with no newline and no indentation what so ever. While it's true that the XML file is valid , it is very hard for a human to examnine it. Is the...

MSXML from C++ - pretty print / indent newly created documents

I'm writing out XML files using the MSXML parser, with a wrapper I downloaded from here: http://www.codeproject.com/KB/XML/JW_CXml.aspx. Works great except that when I create a new document from code (so not load from file and modify), the result is all in one big line. I'd like elements to be indented nicely so that I can read it easily...

Is there a function in Python to print all the current properties and values of an object?

So what I'm looking for here is something like PHP's print_r function. This is so I can debug my scripts by seeing what's the state of the object in question. ...

Ugly C++ code

I'm working on a C++ prettyprinter and would like to show the results of the prettyprinter by comparing code before and after running it. Does anyone know where I can find some ugly C++ code to run through the prettypretty? Ideally the code would come from some open source software. ...

Best way to pretty print XML response in grails.

given this in a grails action: def xml = { rss(version: '2.0') { ... } } render(contentType: 'application/rss+xml', xml) i see this: <rss><channel><title></title><description></description><link></link><item></item></channel></rss> is there an easy way to pretty print the xml? something built into the render method,...

Nice bit of code to format an xml string

hi Anyone got a ready made function that will take an XML string and return a correctly indented string? eg <XML><TAG1>A</TAG1><TAG2><Tag3></Tag3></TAG2></XML> and will return nicely formatted String in return after inserting linebreaks and tabs or spaces? Yes I know the code is easy to write but I'm sure someone else has already w...

one pretty printer "to rule them all"

Hi, I'm looking for a tool that can pretty-print (AKA tidy or beautify) source code in as many languages as possible. Those I'm particularly keen on include: Java JSP HTML JavaScript SQL JSON XML Ideally, the tool should be able to update source files in-place and be able to format more than a single file at-a-time. It would be ...

Can anyone point me at a good example of pretty printing rules to "english"

I've got the equivalent of an AST that a user has built using a rule engine. But when displaying a list of the rules, I'd like to be able to "pretty print" each rule into something that looks nice**. Internally when represented as a string they look like s-expressions so imagine something like: (and (contains "foo" "foobar") (equals 4...

Pretty printing of DateTime values in C#

I'm hoping that someone has found a way of doing this already or that there is a library already in existence. It's one of those things that would be nice but is in no way necessary for the time being. The functionality I'm looking for is something like datejs in reverse. Thanks, Simon. ...

Looking for a configurable pretty printer for C# code.

I work on a team with about 10 developers. Some of the developers have very exacting formatting needs. I would like to find a pretty printer that I could configure to these specifications and then add to the build processes. In this way no matter how badly other people mess up the format when it is pulled down from source control it will...

Do you try to make your code look pretty?

I might be one anal programmer, but I like code that looks good from a distance. I just found myself lining up a CSS style so that instead of this: #divPreview { text-align: center; vertical-align: middle; border: #779 1px solid; overflow: auto; width: 210px; height: 128px; background-color: #fff" } it now looks like: #divPrev...

Java console pretty printing: returning to the start of a line

Hello In Java, how can I return to the start of a line and overwrite what has already been output on the console? System.out.print(mystuff+'\r'); does not appear to work. thanks in advance ...

Best pretty-printing library for Java?

What is the single best pretty-printing library for Java? I mean a library for printing formatted output with indentation, break hints, etc., not a library for beautifying/re-formatting Java code itself. Ideally, the library would "play nice" with System.out.println and friends. For an idea of what I'm looking for, see OCaml's Format mo...

How to pretty-print JSON script?

Is there a (*nix) command-line script to format JSON in human-readable form? Basically, I want it to transform the following: { foo: "lorem", bar: "ipsum" } ... into something like this: { foo: "lorem", bar: "ipsum" } Thanks! ...

Reformatting JavaScript/JScript code?

I've got a JScript error on my page. I know where the error's happening, but I'm attempting to decipher the JScript on that page (to figure out where it came from -- it's on an ASPX page, so any number of user controls could have injected it). It'd be easier if it was indented properly. Are there any free JScript reformatters for Window...

Pretty printing XML with javascript

I have a string that represents a non indented XML that I would like to pretty-print. For example: <root><node/></root> should become: <root> <node/> </root> Syntax highlighting is not a requirement. To tackle the problem I first transform the XML to add carriage returns and white spaces and then use a pre tag to output the XML. ...

Vim indentation for c++ templates?

Does anyone have or know about vim plugin/macro/function that indents nicely c++ templates? When I highlight template definition in vim .hpp/.h file and indent it with '=' I get something like this: > template < > class TFilter, > class TParser, > class TConsumer, > class TDataProce...