tidy

HTML Formatter in Javascript

不羁岁月 提交于 2019-12-06 08:09:30
I have been looking around for a HTML formatter to incorporate with a project I am doing. I need it to be written in Javascript since I want the formatting done on the client side. The problem is, the few that I have tried don't work very well... For example: http://www.davidpirek.com/blog/html-beautifier-jquery-plugin : Has a problem with one of the For loops (in the cleanAsync function). Chrome says "unexpected token ILLEGAL" JS Beautifier on GitHub : When I have links in the HTML it will put a newline character after it. The problem is, I have a period directly after the link in some cases

tidying html with ckeditor

笑着哭i 提交于 2019-12-06 00:34:58
Hi I've got a small problem with ckeditor, basically I need to make the editor run it's html cleanup command. Is there any way of doing this. At present it doesn't seem to run after I type some stuff into the source and then press save I would like it to tidy the html like it does in the 'normal' editor view Any ideas? Thanks Richard here is some example code <SCRIPT type=text/javascript src="http://www.johnpricephotography.co.uk/crawler.js"> /* Text and/or Image Crawler Script v1.5 (c)2009-2011 John Davenport Scheuer as first seen in http://www.dynamicdrive.com/forums/ username: jscheuer1 -

Pretty-print HTML via PHP without validation?

余生颓废 提交于 2019-12-05 22:02:15
问题 I'd like to automatically pretty-print (indentation, mostly) the HTML output that my PHP scripts generate. I've been messing with Tidy, but have found that in its efforts to validate and clean my code, Tidy is changing way too much. I know Tidy's intentions are good but I'm really just looking for an HTML beautifier. Is there a simpler library out there that can run in PHP and just do the pretty-printing? Or, is there a way to configure Tidy to skip all the validation stuff and just beautify?

How to tidy up malformed xml in ruby

怎甘沉沦 提交于 2019-12-05 18:59:30
I'm having issues tidying up malformed XML code I'm getting back from the SEC's edgar database . For some reason they have horribly formed xml. Tags that contain any sort of string aren't closed and it can actually contain other xml or html documents inside other tags. Normally I'd had this off to Tidy but that isn't being maintained. I've tried using Nokogiri::XML::SAX::Parser but that seems to choke because the tags aren't closed. It seems to work alright until it hits the first ending tag and then it doesn't fire off on any more of them. But it is spiting out the right characters. class

how to make syntastic with html tidy aware of ionic tags?

十年热恋 提交于 2019-12-05 18:19:45
I'm trying to edit an ionic application with vim that has syntastic enabled using html tidy. Unfortunately, I'm getting a load of errors. How can I make html tidy aware of ionic tags, or failing that make it ignore them so that I don't receive errors like this: www/index.html|26 col 5 error| <ion-pane> is not recognized! ... www/index.html|24 col 3 warning| <body> proprietary attribute "ng-app" The solution for me was to set the following: let g:syntastic_html_tidy_ignore_errors=["<ion-", "discarding unexpected </ion-", " proprietary attribute \"ng-"] 来源: https://stackoverflow.com/questions

Tidy replacing   with a weird character

耗尽温柔 提交于 2019-12-05 18:01:56
问题 I am using Tidy (with PHP5) with UTF8 input, output, and char encoding enabled. When I clean a string with an   in it, it is replacing it with an odd character. I've tried messing with the tidy config but nothing I try seems to work. Before Tidy: This is a test.  Why does this not work? After Tidy: This is a test. ▒Why does this not work? I don't know what the character is, but I assume it has something to do with the encoding of the enteties in utf8. Any ideas as to how I can get tidy to

JTidy Node.findBody() — How to use?

﹥>﹥吖頭↗ 提交于 2019-12-05 16:44:59
I'm trying to do XHTML DOM parsing with JTidy, and it seems to be rather counterintuitive task. In particular, there's a method to parse HTML: Node Tidy.parse(Reader, Writer) And to get the <body /> of that Node, I assume, I should use Node Node.findBody(TagTable) Where should I get an instance of that TagTable? (Constructor is protected, and I haven't found a factory to produce it.) I use JTidy 8.0-SNAPSHOT. I found there's much simpler method to extract the body: tidy = new Tidy(); tidy.setXHTML(true); tidy.setPrintBodyOnly(true); And then use tidy on the Reader-Writer pair. Simple as it

Using Tidy2 for Notepad++

ぃ、小莉子 提交于 2019-12-05 05:08:00
Something realy strange happend when i try use Tidy2 on my html pages. HTML Entities change from this   to this xA0 ( screenshot ) I try different settings in config file but nothing help. Please, some advise Ricardo Zorio You need to set the preserve-entities to 1 http://tidy.sourceforge.net/docs/quickref.html#preserve-entities just add to the end of the config file preserve-entities: 1 to open the config file go to: Plugins > Tidy2 > Edit config n source: https://stackoverflow.com/a/6669947/2455951 If you use Tidy2, go to: Plugins->Tidy2->Show Config Help There you will find how to do a

Cleaning HTML with Nokogiri (instead of Tidy)

做~自己de王妃 提交于 2019-12-05 04:35:44
The tidy gem is no longer maintained and has multiple memory leak issues. Some people suggested using Nokogiri. I'm currently cleaning the HTML using: Nokogiri::HTML::DocumentFragment.parse(html).to_html I've got two issues though: Nokogiri removes the DOCTYPE Is there an easy way to force the cleaned HTML to have a html and body tag? If you are processing a full document, you want: Nokogiri::HTML(html).to_html That will force html and body tags, and introduce or preserve the DOCTYPE : puts Nokogiri::HTML('<p>Hi!</p>').to_html #=> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" #

Pretty-print HTML via PHP without validation?

倖福魔咒の 提交于 2019-12-04 03:39:53
I'd like to automatically pretty-print (indentation, mostly) the HTML output that my PHP scripts generate. I've been messing with Tidy, but have found that in its efforts to validate and clean my code, Tidy is changing way too much. I know Tidy's intentions are good but I'm really just looking for an HTML beautifier. Is there a simpler library out there that can run in PHP and just do the pretty-printing? Or, is there a way to configure Tidy to skip all the validation stuff and just beautify? The behaviour that you've observed when using Tidy is a result of the underlying use of DOM API.