Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use Tidy on html #1164

Closed
wichtounet opened this issue Mar 24, 2014 · 13 comments
Closed

Unable to use Tidy on html #1164

wichtounet opened this issue Mar 24, 2014 · 13 comments
Assignees
Labels
Milestone

Comments

@wichtounet
Copy link

Hi,

I enabled the tidy filter on html file:

from nikola import filters
FILTERS = {
".html": [filters.tidy],
}

and now NIkola refuses to build my site:

TaskError - taskid:render_tags:../categories/index.html
PythonAction Error
Traceback (most recent call last):
File "/usr/lib64/python3.3/site-packages/doit/action.py", line 360, in execute
returned_value = self.py_callable(_self.args, *_kwargs)
File "/usr/lib64/python3.3/site-packages/nikola/utils.py", line 529, in unlessLink
action(target)
File "/usr/lib64/python3.3/site-packages/nikola/filters.py", line 144, in tidy
for line in output.split("\n"):
TypeError: Type str doesn't support the buffer AP

Is there a problem with tidy ? Can I use another thing as a replacement ?

@ralsina
Copy link
Member

ralsina commented Mar 24, 2014

You are using python 3, right? Probably it's just that noone tried this and it's not working right.

@wichtounet
Copy link
Author

Yes, I'm using Python 3.3, but the 2.7 version is also installed. If I have installed nikola using pip, is there a way to change the Python version used ?

@ralsina
Copy link
Member

ralsina commented Mar 24, 2014

Easiest is just to install it again: pip-2.7 install nikola

Or wait 15' and I'm sure I can find you a simple patch ;-)

I was lying, probably won't have time to look at it today.

@Kwpolska Kwpolska self-assigned this Mar 25, 2014
@Kwpolska Kwpolska added this to the v7.0.0 milestone Mar 25, 2014
@Kwpolska Kwpolska added the bug label Mar 25, 2014
@Kwpolska
Copy link
Member

I’ll attempt a fix soon.

Kwpolska added a commit that referenced this issue Mar 25, 2014
Signed-off-by: Chris “Kwpolska” Warrick <[email protected]>
@ralsina
Copy link
Member

ralsina commented Mar 25, 2014

With all that brokenness in the tool, it's sort of pointless.

@Kwpolska
Copy link
Member

So, what is the official resolution?

(a) nuke tidy-in-Nikola altogether; or
(b) pull in #1167 and mark tidy as “not production-ready as it destroys many HTML5 things (don’t forget it was last updated in 2009)”

@da2x
Copy link
Contributor

da2x commented Mar 25, 2014

(c) Tidy-HTML-Light were we strip empty lines and indenting spaces altogether. Force line breaks before and after closing sectioning elements. Better than nothing.

@Kwpolska
Copy link
Member

Google doesn’t seem to know what Tidy-HTML-Light is. Same goes for DuckDuckGo. I’m pretty sure it doesn’t exist.

@ralsina
Copy link
Member

ralsina commented Mar 25, 2014

Well, if the goal is to produce pretty HTML, we could just use lxml and pretty-print it.

@da2x
Copy link
Contributor

da2x commented Mar 25, 2014

Two kind of goals here: smaller output (stripped whitespace) or pretty HTML.

Tidy-HTML-Light is better known as regex.

@wichtounet
Copy link
Author

Thanks for the help. I tried using 2.7, but after that, my site refused to build with an UTF-8 error. I will continue 3.3. It was more a test than a real need, so don't worry too much about it for me.

Do I let the issue open ?

@Kwpolska
Copy link
Member

@wichtounet you should create a new issue describing the UTF-8 problem. We will close this issue if we believe we fixed it well enough (or that we won’t fix it).

@ralsina
Copy link
Member

ralsina commented Mar 26, 2014

@Aeyoun

For stripping whitespace, yui-compress or whatever does a much better job. For prettier HTML, lxml does a much better job. So, let's fix this by removing tidy.

Kwpolska added a commit that referenced this issue Apr 27, 2014
Signed-off-by: Chris “Kwpolska” Warrick <[email protected]>
ralsina added a commit that referenced this issue Apr 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants