• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Command line argument to reformat .wo components template
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Command line argument to reformat .wo components template


  • Subject: Re: Command line argument to reformat .wo components template
  • From: Steve Quirk <email@hidden>
  • Date: Tue, 22 Jul 2008 08:36:09 -0400 (EDT)



On Mon, 21 Jul 2008, Jean-Fran?ois Veillette wrote:

I use this one to reformat java source :
/path/to/eclipse -application org.eclipse.jdt.core.JavaCodeFormatter -verbose -config /Path/To/Perfect/Setting/.settings/org.eclipse.jdt.core.prefs /Path/To/Source/To/Reformat/


What would be the invocation to reformat .wo/*.{html,wod} files ?

I want command-line argument, because I want to rewrite a whole bunch of files at once, not going file by file in Eclipse and hit apple-shift-F for every files.

Have you inherited a project that's making your eyes bleed and your brain hurt?


Most people would advise against wholesale reformatting for the sake of reformatting (mostly because it makes deciphering diffs tough), but since you have the gun pointed at your foot, let's give you some ammo...

To reformat the .html files, you can use xmllint. It's going to try to put body tags on every component, but you can clean those up.. something like:
for h in `find . -name \*.html -print`
do
if [ xmllint --html --xmlout --format $h > $h.xml ]; then
mv $h $h.bak
mv $h.bak $h
fi
done


It has the advantage of creating xhtml for you. You may find some way of supressing the outer body tags (you can always get the source & modify it).

In the past, I've written a program that used the WOTemplateParser to remove bogus <webobjects> tags (e.g. WOImage with static resources, WOStrings with constant values, ...) and rewrite them in my preferred format (in order of occurence in the file, not alphabetical). It was based on 5.2 and I doubt very much it works with 5.4, but if you want to fool with it, I can email it.

Steve


- jfv
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Command line argument to reformat .wo components template
      • From: Jean-François Veillette <email@hidden>
References: 
 >Command line argument to reformat .wo components template (From: Jean-François Veillette <email@hidden>)

  • Prev by Date: Re: generics fun
  • Next by Date: Re: Command line argument to reformat .wo components template
  • Previous by thread: Re: Command line argument to reformat .wo components template
  • Next by thread: Re: Command line argument to reformat .wo components template
  • Index(es):
    • Date
    • Thread