Skip to content
This repository has been archived by the owner on Apr 14, 2019. It is now read-only.

tidyp removes whitespace between end tag and text #21

Open
shlomif opened this issue Mar 27, 2017 · 5 comments
Open

tidyp removes whitespace between end tag and text #21

shlomif opened this issue Mar 27, 2017 · 5 comments

Comments

@shlomif
Copy link

shlomif commented Mar 27, 2017

With this i.html:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title>Test page</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<p>
Style and look based on the
<a href="http://wordpress.org/extend/themes/smoked">Smoked WordPress Theme</a>
by <a href="http://wordpress.org/extend/themes/profile/iconstantin">iconstantin</a>.
</p>
</body>
</html>

And this perl program:

#!/usr/bin/perl

use strict;
use warnings;

use HTML::Tidy ();

my $tidy = HTML::Tidy->new(
    {
        'input_xml'     => 1,
        'output_xml'    => 1,
        'char_encoding' => 'utf8',
    }
);

local $/;
print $tidy->clean(scalar <>);

I am getting this output:

shlomif[homepage]:$trunk$ perl p.pl < i.html
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title>Test page</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<p>Style and look based on the
<a href="http://wordpress.org/extend/themes/smoked">Smoked WordPress Theme</a>by 
<a href="http://wordpress.org/extend/themes/profile/iconstantin">iconstantin</a>.</p>
</body>
</html>
shlomif[homepage]:$trunk$ ls

As can be noticed the </a>by is faulty. Please look into fixing it.

Update: I am using lib64tidyp1.04_0-1.04-9.mga6 and perl-HTML-Tidy-1.560.0-9.mga6 on Mageia 6.

@petdance
Copy link
Owner

tidyp is just a clone of libtidy. I don't plan on making any changes to it. libtidy has pretty much been ignored for years.

@shlomif
Copy link
Author

shlomif commented Mar 27, 2017 via email

@petdance
Copy link
Owner

I meant a clone. I just copied the repo and put a version number on it so that HTML::Tidy would have something to build against.

There are no other alternatives that I am aware of.

If you can fix the bug you're referring to, let's talk. You say that bugs "bother other people". Do you know of anyone besides you using it?

@shlomif
Copy link
Author

shlomif commented Mar 27, 2017 via email

@shlomif
Copy link
Author

shlomif commented Jun 25, 2017

@petdance (and all): just a note that using this DDG search - https://duckduckgo.com/?q=html+minifier&ia=web I learned about this project - https://github.com/kangax/html-minifier - which I adapted to use for minification instead of tidyp (I'm still using tidyp for validation). Hope it helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants