<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: javascript beautifier</title>
	<atom:link href="http://verens.com/2007/02/23/javascript-beautifier/feed/" rel="self" type="application/rss+xml" />
	<link>http://verens.com/2007/02/23/javascript-beautifier/</link>
	<description>klog - Kae&#039;s Log</description>
	<lastBuildDate>Mon, 21 May 2012 21:11:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Kae Verens</title>
		<link>http://verens.com/2007/02/23/javascript-beautifier/#comment-896</link>
		<dc:creator>Kae Verens</dc:creator>
		<pubDate>Mon, 10 Sep 2007 12:02:50 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2007/02/23/javascript-beautifier/#comment-896</guid>
		<description>I think wordpress is removing anything past the &#039;&lt;&#039; symbol. Use &#039;&lt;&#039; to have it appear.</description>
		<content:encoded><![CDATA[<p>I think wordpress is removing anything past the &#8216;&lt;&#8217; symbol. Use &#8216;&amp;lt;&#8217; to have it appear.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Ullenboom</title>
		<link>http://verens.com/2007/02/23/javascript-beautifier/#comment-895</link>
		<dc:creator>Christian Ullenboom</dc:creator>
		<pubDate>Mon, 10 Sep 2007 07:53:51 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2007/02/23/javascript-beautifier/#comment-895</guid>
		<description>Second part ...
	while(++charAt</description>
		<content:encoded><![CDATA[<p>Second part &#8230;<br />
	while(++charAt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Ullenboom</title>
		<link>http://verens.com/2007/02/23/javascript-beautifier/#comment-894</link>
		<dc:creator>Christian Ullenboom</dc:creator>
		<pubDate>Mon, 10 Sep 2007 07:50:51 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2007/02/23/javascript-beautifier/#comment-894</guid>
		<description>Great. This is what I&#039;m looking for. I wrote a litte wrapper for Java 6 to use it:

package com.tutego.utils;

import java.io.InputStreamReader;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class JavaScriptBeauty
{
  private static ScriptEngine beautyEngine;

  public static String beautify( String s )
  {
    try
    {
      if ( beautyEngine == null )
      {
        beautyEngine = new ScriptEngineManager().getEngineByName( &quot;JavaScript&quot; );
        beautyEngine.eval( new InputStreamReader( FoxproParser.class.getResourceAsStream( &quot;jbeauty.js&quot; ) ) );
      }
      Invocable inv = (Invocable) beautyEngine;

      return inv.invokeFunction( &quot;beauty&quot;, s ).toString();
    }
    catch ( ScriptException e )
    {
      e.printStackTrace();
    }
    catch ( NoSuchMethodException e )
    {
      e.printStackTrace();
    }

    return &quot;&quot;;
  }
}


I changed the script:

function beauty( plaintext )
{
	var plength=plaintext.length;
	cmp=new Comp();
...
	while(++charAt</description>
		<content:encoded><![CDATA[<p>Great. This is what I&#8217;m looking for. I wrote a litte wrapper for Java 6 to use it:</p>
<p>package com.tutego.utils;</p>
<p>import java.io.InputStreamReader;<br />
import javax.script.Invocable;<br />
import javax.script.ScriptEngine;<br />
import javax.script.ScriptEngineManager;<br />
import javax.script.ScriptException;</p>
<p>public class JavaScriptBeauty<br />
{<br />
  private static ScriptEngine beautyEngine;</p>
<p>  public static String beautify( String s )<br />
  {<br />
    try<br />
    {<br />
      if ( beautyEngine == null )<br />
      {<br />
        beautyEngine = new ScriptEngineManager().getEngineByName( &#8220;JavaScript&#8221; );<br />
        beautyEngine.eval( new InputStreamReader( FoxproParser.class.getResourceAsStream( &#8220;jbeauty.js&#8221; ) ) );<br />
      }<br />
      Invocable inv = (Invocable) beautyEngine;</p>
<p>      return inv.invokeFunction( &#8220;beauty&#8221;, s ).toString();<br />
    }<br />
    catch ( ScriptException e )<br />
    {<br />
      e.printStackTrace();<br />
    }<br />
    catch ( NoSuchMethodException e )<br />
    {<br />
      e.printStackTrace();<br />
    }</p>
<p>    return &#8220;&#8221;;<br />
  }<br />
}</p>
<p>I changed the script:</p>
<p>function beauty( plaintext )<br />
{<br />
	var plength=plaintext.length;<br />
	cmp=new Comp();<br />
&#8230;<br />
	while(++charAt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kae Verens</title>
		<link>http://verens.com/2007/02/23/javascript-beautifier/#comment-893</link>
		<dc:creator>Kae Verens</dc:creator>
		<pubDate>Thu, 15 Mar 2007 08:53:59 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2007/02/23/javascript-beautifier/#comment-893</guid>
		<description>thank you! can you show me the error and the fix?</description>
		<content:encoded><![CDATA[<p>thank you! can you show me the error and the fix?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olof Nordenstam</title>
		<link>http://verens.com/2007/02/23/javascript-beautifier/#comment-892</link>
		<dc:creator>Olof Nordenstam</dc:creator>
		<pubDate>Wed, 14 Mar 2007 23:27:42 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2007/02/23/javascript-beautifier/#comment-892</guid>
		<description>I looked around at MANY javascript beautifiers, and none even worked with the huge file that I tried to format. Yours only produced one error (brackets in a regular expression) which was easily fixed. Well done!</description>
		<content:encoded><![CDATA[<p>I looked around at MANY javascript beautifiers, and none even worked with the huge file that I tried to format. Yours only produced one error (brackets in a regular expression) which was easily fixed. Well done!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://verens.com/2007/02/23/javascript-beautifier/#comment-891</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Wed, 14 Mar 2007 09:57:08 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2007/02/23/javascript-beautifier/#comment-891</guid>
		<description>You nearly had me Kae, as I hate untidy JS, but I hate if(a==b) more. :)</description>
		<content:encoded><![CDATA[<p>You nearly had me Kae, as I hate untidy JS, but I hate if(a==b) more. <img src='http://verens.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kae Verens</title>
		<link>http://verens.com/2007/02/23/javascript-beautifier/#comment-890</link>
		<dc:creator>Kae Verens</dc:creator>
		<pubDate>Wed, 28 Feb 2007 12:50:33 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2007/02/23/javascript-beautifier/#comment-890</guid>
		<description>true, miCash. Personally, I simply do not understand why people indent with multiples of spaces, when you can use a single tab, and edit your editor options to display tabs as equal to a number of spaces.

For example, I have my tabs set to display as equal to 2 spaces (&quot;set tabstop=2&quot; in .vimrc). A guy I work with (who I respect as a coder) prefers to use three spaces. I don&#039;t understand that, as you can set vim to use a tabstop of three, and immediately save bandwidth even though visually the code is the same.

I&#039;m still listening to the comments. When I have a few hours to spare, I&#039;ll collate the ideas, expand the app to accommodate them, and announce the updates.</description>
		<content:encoded><![CDATA[<p>true, miCash. Personally, I simply do not understand why people indent with multiples of spaces, when you can use a single tab, and edit your editor options to display tabs as equal to a number of spaces.</p>
<p>For example, I have my tabs set to display as equal to 2 spaces (&#8220;set tabstop=2&#8243; in .vimrc). A guy I work with (who I respect as a coder) prefers to use three spaces. I don&#8217;t understand that, as you can set vim to use a tabstop of three, and immediately save bandwidth even though visually the code is the same.</p>
<p>I&#8217;m still listening to the comments. When I have a few hours to spare, I&#8217;ll collate the ideas, expand the app to accommodate them, and announce the updates.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: miCash</title>
		<link>http://verens.com/2007/02/23/javascript-beautifier/#comment-889</link>
		<dc:creator>miCash</dc:creator>
		<pubDate>Wed, 28 Feb 2007 12:41:16 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2007/02/23/javascript-beautifier/#comment-889</guid>
		<description>As with any project, you have to have an agreed code syntax before you start, otherwise you have everyone getting frustrated with everyone elses code.
if everyone has to deal with other peoples extravagances then that leads to resentment and frustration (as you have described of your own experiences). much better to have everyone on an even keel

white spaces have their place too, and it&#039;s mostly to do with readability. stuff like if statements with lots of conditions. as for the curly braces.... yeah, end of line is better.

one of the things i have most problems with is the number of spaces (or tabs) to indent for each block of code.</description>
		<content:encoded><![CDATA[<p>As with any project, you have to have an agreed code syntax before you start, otherwise you have everyone getting frustrated with everyone elses code.<br />
if everyone has to deal with other peoples extravagances then that leads to resentment and frustration (as you have described of your own experiences). much better to have everyone on an even keel</p>
<p>white spaces have their place too, and it&#8217;s mostly to do with readability. stuff like if statements with lots of conditions. as for the curly braces&#8230;. yeah, end of line is better.</p>
<p>one of the things i have most problems with is the number of spaces (or tabs) to indent for each block of code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kae Verens</title>
		<link>http://verens.com/2007/02/23/javascript-beautifier/#comment-888</link>
		<dc:creator>Kae Verens</dc:creator>
		<pubDate>Sat, 24 Feb 2007 14:50:23 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2007/02/23/javascript-beautifier/#comment-888</guid>
		<description>Ken, what&#039;s wrong with that? That&#039;s exactly how I like it - makes it easier to see the two strands of a conditional statement when &lt;a href=&quot;http://www.vim.org/&quot; rel=&quot;nofollow&quot;&gt;vim&lt;/a&gt; is in folding mode.

On the other ideas expressed, yup - mostly good ideas (although I don&#039;t see the point of coloured syntax in this context...). I&#039;ll probably work up some options for them during the week (yours as well, Ken, even if it&#039;s wrong ;-) )</description>
		<content:encoded><![CDATA[<p>Ken, what&#8217;s wrong with that? That&#8217;s exactly how I like it &#8211; makes it easier to see the two strands of a conditional statement when <a href="http://www.vim.org/" rel="nofollow">vim</a> is in folding mode.</p>
<p>On the other ideas expressed, yup &#8211; mostly good ideas (although I don&#8217;t see the point of coloured syntax in this context&#8230;). I&#8217;ll probably work up some options for them during the week (yours as well, Ken, even if it&#8217;s wrong <img src='http://verens.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken Guest</title>
		<link>http://verens.com/2007/02/23/javascript-beautifier/#comment-887</link>
		<dc:creator>Ken Guest</dc:creator>
		<pubDate>Sat, 24 Feb 2007 11:03:41 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/archives/2007/02/23/javascript-beautifier/#comment-887</guid>
		<description>hmm. lines like &quot;} else {&quot; got changed to &quot;}\n else {&quot; - I&#039;d suggest fixing that :-)</description>
		<content:encoded><![CDATA[<p>hmm. lines like &#8220;} else {&#8221; got changed to &#8220;}\n else {&#8221; &#8211; I&#8217;d suggest fixing that <img src='http://verens.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

