Is it possible to preserve extra line breaks when using [input-xml: yes] [indent: yes]

View: New views
5 Messages — Rating Filter:   Alert me  

Is it possible to preserve extra line breaks when using [input-xml: yes] [indent: yes]

by Robert Parks-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Say xml input is:

<root>
<a><b>c</b></a>

<a><b>c</b></a>
</root>

When I run with:
input-xml: yes
indent:yes
indent-spaces:2

It strips the newlines:
<root>
  <a>
    <b>c</b>
  </a>
  <a>
    <b>c</b>
  </a>
</root>

I would rather have the output to be:

<root>
  <a>
    <b>c</b>
  </a>

  <a>
    <b>c</b>
  </a>
</root>

Is there an parameter I can set so it preserves extra newlines? I am
trying to copy the behavior of MS Visual Studio 2008.

Thanks!
Rob



Re: Is it possible to preserve extra line breaks when using [input-xml: yes] [indent: yes]

by Arnaud Desitter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
Try http://tidy.sourceforge.net/docs/quickref.html#vertical-space
Regards,

On 28/04/2009, Robert Parks <robertjparks@...> wrote:

> Say xml input is:
>
> <root>
> <a><b>c</b></a>
>
> <a><b>c</b></a>
> </root>
>
> When I run with:
> input-xml: yes
> indent:yes
> indent-spaces:2
>
> It strips the newlines:
> <root>
>  <a>
>    <b>c</b>
>  </a>
>  <a>
>    <b>c</b>
>  </a>
> </root>
>
> I would rather have the output to be:
>
> <root>
>  <a>
>    <b>c</b>
>  </a>
>
>  <a>
>    <b>c</b>
>  </a>
> </root>
>
> Is there an parameter I can set so it preserves extra newlines? I am
> trying to copy the behavior of MS Visual Studio 2008.
>
> Thanks!
> Rob
>
>
>



Re: Is it possible to preserve extra line breaks when using [input-xml: yes] [indent: yes]

by Robert Parks-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I tested: vertical-space:true

It seems like this adds arbitrary line breaks. I am trying to have it
preserve the line breaks that already exist in the file.

Thanks,
Rob



On Tue, Apr 28, 2009 at 11:26 AM, Arnaud Desitter
<arnaud02@...> wrote:

> Hi,
> Try http://tidy.sourceforge.net/docs/quickref.html#vertical-space
> Regards,
>
> On 28/04/2009, Robert Parks <robertjparks@...> wrote:
>> Say xml input is:
>>
>> <root>
>> <a><b>c</b></a>
>>
>> <a><b>c</b></a>
>> </root>
>>
>> When I run with:
>> input-xml: yes
>> indent:yes
>> indent-spaces:2
>>
>> It strips the newlines:
>> <root>
>>  <a>
>>    <b>c</b>
>>  </a>
>>  <a>
>>    <b>c</b>
>>  </a>
>> </root>
>>
>> I would rather have the output to be:
>>
>> <root>
>>  <a>
>>    <b>c</b>
>>  </a>
>>
>>  <a>
>>    <b>c</b>
>>  </a>
>> </root>
>>
>> Is there an parameter I can set so it preserves extra newlines? I am
>> trying to copy the behavior of MS Visual Studio 2008.
>>
>> Thanks!
>> Rob
>>
>>
>>
>


Re: Is it possible to preserve extra line breaks when using [input-xml: yes] [indent: yes]

by Arnaud Desitter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Tidy re-formats its input and discards any incoming line breaks.
Therefore, it does not do what you want.

Regards,

On 28/04/2009, Robert Parks <robertjparks@...> wrote:

> I tested: vertical-space:true
>
> It seems like this adds arbitrary line breaks. I am trying to have it
> preserve the line breaks that already exist in the file.
>
> Thanks,
> Rob
>
>
>
> On Tue, Apr 28, 2009 at 11:26 AM, Arnaud Desitter
> <arnaud02@...> wrote:
> > Hi,
> > Try http://tidy.sourceforge.net/docs/quickref.html#vertical-space
> > Regards,
> >
> > On 28/04/2009, Robert Parks <robertjparks@...> wrote:
> >> Say xml input is:
> >>
> >> <root>
> >> <a><b>c</b></a>
> >>
> >> <a><b>c</b></a>
> >> </root>
> >>
> >> When I run with:
> >> input-xml: yes
> >> indent:yes
> >> indent-spaces:2
> >>
> >> It strips the newlines:
> >> <root>
> >>  <a>
> >>    <b>c</b>
> >>  </a>
> >>  <a>
> >>    <b>c</b>
> >>  </a>
> >> </root>
> >>
> >> I would rather have the output to be:
> >>
> >> <root>
> >>  <a>
> >>    <b>c</b>
> >>  </a>
> >>
> >>  <a>
> >>    <b>c</b>
> >>  </a>
> >> </root>
> >>
> >> Is there an parameter I can set so it preserves extra newlines? I am
> >> trying to copy the behavior of MS Visual Studio 2008.
> >>
> >> Thanks!
> >> Rob
> >>
> >>
> >>
> >
>



Re: Is it possible to preserve extra line breaks when using [input-xml: yes] [indent: yes]

by Lee Passey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Arnaud Desitter wrote:

> Hi,
>
> Tidy re-formats its input and discards any incoming line breaks.
> Therefore, it does not do what you want.

If I may, I would like to amplify on M. Dessitter's comments.

One of the earliest requirements for web browsers was that they must not
fail catastrophically; that is, if the web document that was delivered
to them contained errors, they must guess at to what presentation was
originally desired and must not simply display an error.

One of the consequences of this requirement was that a lot of really
bad, non-conformant HTML was written, because usually the web browsers
of the day could deal with it.

The goal of Tidy was, and is, to take that really bad HTML and fix it.
The way to fix bad HTML is not always clear, and in some of these cases
Tidy issues a warning to the effect of "I fixed it this way, but it may
not be what you want." In other cases the HTML is so bad that Tidy can't
even make a good guess, so it issues an error telling the user that some
specific markup has to be fixed by hand.

It is not, and never has been, the goal of Tidy to take good HTML and
simply reformat it. Of course, there are "pretty print" routines as part
of Tidy because once an HTML document has been fixed it needs to be
output in a reasonable form. But reformatting an HTML document is a
side-effect of the repair action, and not a goal in and of itself.

I'm sure there are a number of applications whose primary function is to
re-format or "pretty print" an HTML document. Mr. Parks identifies
Visual Studio as one of those applications. This is not, however, Tidy's
function. If "pretty printing" is the desired behavior, with detailed
control over the output, some application other than Tidy should be used.