forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Crossley <cross...@apache.org>
Subject Re: Automated formatting of XML files
Date Sat, 27 Aug 2005 00:01:15 GMT
Diwaker Gupta wrote:
> David Crossley wrote:
> > Diwaker Gupta wrote:
> > > When I say XML, I mean all kinds of XML files (XSL, *.fv, *.ft)
> > 
> > How will the tool know which are xml file-types?
> > We have a multitude of xml filename extensions.
> > There is a list on one of the tools in the
> > "committers" svn repository at relicense/src/insert.pl
> 
> I don't see why this is a problem. I'll just write a simple script
> that runs the tool on whatever extensions we use for XML files. Tidy
> doesn't know/care about the file extension -- you just feed it some
> input, and it gives you the output.

Because there are so many filename extensions. When i use
that "insert_license.pl" it has a list of known filename
extensions, and then searches for all text files and reports
a list of new unknown ones. Gradually i investigate and add
them to the tool. So it will give us the list.

> > I think that it is doing too much, e.g. removing the
> > blank lines before major elements, e.g. <xsl:template>
> 
> Like I said, its configurable. We can pick and choose. Since this is
> an automated process, I'm not too worried about the tool doing "too
> much" -- just change the config, re run and voila!

I am worried, because we will get swamped with huge diffs
everytime the changes are made. I see two problems with that:
Email volume: our mailboxes will fill up.
Risk for svn conflicts: smaller changes have least chance
of causing conflicts when developers have local changes.

> > We should start with very simple stuff, e.g. just tabs
> > and trailing whitespace, then gradually add other operations.
> > However we don't want to get too strict on code style.
> 
> Agreed.
> 
> > I suggest that we define a list of what we would possibly
> > want to adrress. Here is a start:
> > 
> > 1 whitespace at end-of-line
> 
> > 2 tabs to four-space
> 
> You mean 2 spaces.

Yes sorry. Copy-and-paste error.

> > 3 indentation
> 
> Ok.
> 
> > 4 word-wrap for long lines
> 
> What would be a good length? Right now I use 80.
>
> > 5 whitespace between attribute definitions
> 
> Ok.
>
> > We need to at least do 1 and 2 while 5 may be doubtful.
> > 
> > It seems to be too vigorous with wrapping. Perhaps wider
> > would be better.
> > <   <xsl:key name="h5s" match="h5" use="generate-id(preceding-sibling::h4[1])"/>
> > ---
> > >   <xsl:key name="h5s" match="h5"
> > >   use="generate-id(preceding-sibling::h4[1])" />
> 
> It won't wrap if there are no spaces to break the line at. It won't
> wrap between attribute values (I think this is configurable though). I
> usually use 80 in my editor as well, so this works for me. We can set
> it to 100 or something else if that works for more people.

Well there were too many wrappings in your example. 
If it gets wrapped at all, then probably wider.
However i wonder if we should do any word-wrap.

Oh, just noticed another change:

6) space before close of end-tag.

> > Also we need to run it on one of the xdocs
> > in site-author/content/xdocs to see what it does
> > with word-wrapping for long lines of element content.
> 
> I'll do this soon.
> 
> -- 
> Web/Blog/Gallery: floatingsun.net

Mime
View raw message