pretty-print

Setting pretty print tags through javascript

Im trying to get pretty.js to prettify code in CODE tags, using this js: onload_functions.push(function() { var node_list=document.getElementsByTagName('code'); for (i=0; i < node_list.length; i++) { node_list[i].setAttribute('class','prettyprint'); } prettyPrint(); }); This works fine for Firefox :) but IE's havi...

Pretty-print/colorize C#

Searched but couldn't find this answer. I've got some C# code I'm displaying on an HTML page. Can someone recommend for me a FREE JavaScript file that will colorize the C# code, like VS does? ...

Regex to Indent an XML File.

Is it possible to write a REGEX (search replace) that when run on an XML string will output that XML string indented nicely? If so whats the REGEX :) ...

Clearest way to comma-delimit a list (Java)?

Using a comma is just to make it specific - it could be any delimiter, so using List's default toString() doesn't help. (The question could be rephrased as: "best way to implement List's toString?") This is a well-known problem, and I know several ways of doing it, but I'm wondering what the best way is (where "best" means clearest and...

Pretty-printing C# from Python

Suppose I wrote a compiler in Python or Ruby that translates a language into a C# AST. How do I pretty-print this AST from Python or Ruby to get nicely indented C# code? Thanks, Joel ...

Is there a program that will auto format my javascript?

Duplicate: Javascript Beautifier Is there a way I can auto format my javascript so its readable? I have a javascript file that is just one line but about a million columns white. I don't want to go through and tab through each function just so I can read it. Anyone know of a program that will do this for me? Thanks! ...

Better way to print object than Write-Host

I use Write-Host analyze objects, but some times it is hard to understand what the object actually is. Consider: Write-Host $null Write-Host @() Write-Host @($null, $null) Prints: # Actually it prints nothing I would like some thing like this: Null @() @(Null, Null) Any suggestions? ...

Algorithm for neatly indenting SQL statements (Python implementation would be nice)

I'd like to reformat some SQL statements that are a single string with newlines in to something that's much easier to read. I don't personally know of a good coding style for indenting SQL - how should nested queries / where clauses / left joins / etc by represented to maximise readability? Has anyone seen a pretty-printing algorithm t...

How to write a custom pretty printer

A problem that has frequently come up in my career is I have some kind of data structure (perhaps an s-expression) and I want to print it in a human readable form complete with reasonable indentation choices. Is there a book or blog entry that describes how to do this elegantly? I am interested in the algorithm more than a specific lib...

Pretty Print for (Informix-)4gl code

Hi, i'm searching for a pretty print program (script, code, whatever) for Informix-4GL sources. Do you know any ? Than you, Peter. ...

How do I create a nice -description method that nests recusively like NSArray

The -description method for NSArray will nest recursive calls as in: 2009-05-15 14:28:09.998 TestGUIProject[29695:813] ( a, // Array1 item 1 ( // Array2, a second array, nicely indented another 4 spaces a // Item in Array2 ) // End of Array2 ) // End of Array1 I want to do something similar for my own custom cl...

Format XML with JAXB during unmarshal

Hi there, I want to format a XML document during unmarshal with JAXB. Unmarshal looks like: Unmarshaller u = createAndsetUpUnmarshaller(enableValidation, evtHandler, clazz); return u.unmarshal(new ByteArrayInputStream(stringSource.getBytes())); While marshaling one can format the code via: marshaller.setProperty(Marshaller.JAXB_FORM...

What are the best prettyprint options for C++?

Hi All, My partner and I are working on a prettyprinter for C++. The tool parses C++ and prints the resulting AST, so we have quite a bit of flexibility. We've implemented a few options for the user to control the output and now we're looking for opinions about the most important options. If you could take a look at our current (belo...

How can I pretty-print XML source using VB6 and MSXML?

I've been looking after this for months now and I mostly found sites asking the same question. The answers I did found were always for .NET or C++ or involved XSLT. ...

Intellij IDEA plugin for saving Java -> HTML?

Is there an IDEA plugin for pretty printing (or save/export) Java to syntax colored HTML? Failing that, what's your favorite web site for that? EDIT: I have a Java program, I want to convert the source code to HTML so that I can display it on the web. As I will be making lots of edits to the source, it would be handy to be able to con...

Is there a pretty print for PHP?

I'm fixing some PHP scripts and I'm missing ruby's pretty printer. i.e. require 'pp' arr = {:one => 1} pp arr will output {:one => 1}. This even works with fairly complex objects and makes digging into an unknown script much easier. Is there some way to duplicate this functionality in PHP? ...

Converting Source ASCII Files to JPEGs

I publish technical books, in print, PDF, and Kindle/MOBI, with EPUB on the way. The Kindle does not support monospace fonts, which are kinda useful for source code listings. The only way to do monospace fonts is to convert the text (Java source, HTML, XML, etc.) into JPEG images. More specifically, due to pagination issues, a given inp...

How to print pretty xml in javascript?

What's the best way to pretty-print xml in JavaScript? I obtain xml content through ajax call and before displaying this request in textarea i want to format it so it looks nice to the eye :) ...

Changing the default indentation of etree.tostring in lxml

I have an XML document which I'm pretty-printing using lxml.etree.tostring print etree.tostring(doc, pretty_print=True) The default level of indentation is 2 spaces, and I'd like to change this to 4 spaces. There isn't any argument for this in the tostring function; is there a way to do this easily with lxml? ...

Pretty-printing output from javax.xml.transform.Transformer with only standard java api (Indentation and Doctype positioning)

Using the following simple code: package test; import java.io.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; public class TestOutputKeys { public static void main(String[] args) throws TransformerException { // Instantiate transformer input Source xmlInput = new StreamSource(new StringReader( "<!-- Doc...