Wrapping in HTML

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Wrapping in HTML

Ashok Renukappa
Hi All,

I have a requirement, where i want to wrap HTML content in my java code according to some length.

Say for example:
----------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>tidy</title>
</head>
<body>
<p>
Thisisa paragraphwithasmallerline-height.<br />Thisisaparagraphwithasmallerline-height.<br />
Thisisaparagraphwithasmallerline-height.<br /><br />
Thisisaparagraphwithasmallerline-height.<br /><br />
</p>

</body>

</html>

----------------------------------------------------------------------------------------------------------------------------------------

Given the above input and length 5, i want following output.


----------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>tidy</title>
</head>
<body>
<p>
Thisi
sa pa
ragra
phwit
hasma
llerl
ine-h
eight
.<br />Thisi
sapar
agrap
hwith
asmal
lerli
ne-he
ight.<br />
Thisi
sapar
agrap
hwith
asmal
lerli
ne-he
ight.<br /><br />
Thisi
sapar
agrap
hwith
asmal
lerli
ne-he
ight.<br /><br />
</p>


</body>

</html>




----------------------------------------------------------------------------------------------------------------------------------------





--
Ashok R
Lead - Software Development
Verisign India Pvt Ltd.
Bengalooru.
Reply | Threaded
Open this post in threaded view
|

Re: Wrapping in HTML

Bjoern Hoehrmann
* Ashok Renukappa wrote:
>I have a requirement, where i want to wrap HTML content in my java code
>according to some length.

Tidy can't realy help you with this. You could try using, say, `-wrap 1`
and then run a script over the output making the desired replacement,
taking good care that you don't edit into tags and attribute values and
so on, but generally speaking you would be better off with a different
tool (like a proper XML or HTML parser where you can make the changes in
a more structured manner).
--
Björn Höhrmann · mailto:[hidden email] · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/