Tidy not quite processing XML as I would like

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

Tidy not quite processing XML as I would like

by codefire :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm having problems getting Tidy to format output as I would like. The main problem seems to be how it's handling inline tags. It's putting them on their own line and not getting the subsequent spacing quite right.

[code]
...
  <description>
    <p>Sessions have a concept of a 'currently logged in user', reflected by
    <linkto type="jsapi">zimki_session.prototype.user</linkto>,
    <linkto type="jsapi">zimki_session.prototype.user_id</linkto>and
    <linkto type="jsapi">zimki_session.prototype.username</linkto>. This method checks that the user with the username specified has the
    password specified, throwing an exception if not, and sets the currently logged in user appropriately.</p>
...
[/code]


Note the linkto tags are put on their own lines. Also, notice that the space between the tag and the 'and' has disappeared. I wouldn;t mind the inline tags being on their own line so much if spaces were handled correctly.

Anyone got any ideas how to fix this please?

My config file looks like this:

[code]
# General
tidy-mark: no
char-encoding: utf8
logical-emphasis: yes
enclose-text: yes
enclose-block-text: yes
newline: LF

# tags
new-pre-tags: codeblock
new-inline-tags: explanation, string, code, val, linkto
new-blocklevel-tags: api, returns, params, param, description, example, exceptions, exception, p

# Layout
markup: yes
wrap: 140
tab-size: 2
indent: auto
indent-spaces: 2
indent-attributes: yes
vertical-space: no

# XML directives
input-xml: yes
output-xml: yes
add-xml-space: yes
[/code]

Re: Tidy not quite processing XML as I would like

by Bjoern Hoehrmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


* codefire wrote:
>Note the linkto tags are put on their own lines. Also, notice that the space
>between the tag and the 'and' has disappeared. I wouldn;t mind the inline
>tags being on their own line so much if spaces were handled correctly.

># XML directives
>input-xml: yes

If your input document is HTML with some extra elements, you should not
specify this parameter. If it is just some custom XML format, there is
probably no way right now to get the formatting right. There are other
more suitable tools than Tidy to format XML documents. The Tidy bug
tracker (linked from http://tidy.sf.net) has a number of bugs filed on
XML pretty printing. They are unlikely to be addressed any time soon.
--
Björn Höhrmann · mailto:bjoern@... · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/