Re: Command line argument to reformat .wo components template
Re: Command line argument to reformat .wo components template
- Subject: Re: Command line argument to reformat .wo components template
- From: Jean-François Veillette <email@hidden>
- Date: Tue, 22 Jul 2008 08:52:01 -0400
Le 08-07-22 à 08:36, Steve Quirk a écrit :
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?
I simply have 2 branches, of a single project, that diverged long
time ago. One branch was the move to Eclipse, the other branch was
the production branch on XCode. Now I want to remove change noise by
reformating all components, leaving only meaningfull changes.
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).
I might try this, for my immediate need.
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.
Yes I would like this code, because I'm considering rewriting my
change history (git filter-branch) in order to remove change noise on
one of my own project.
Thanks,
- 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