tidy

HTML tidy/cleaning in Ruby 1.9

喜欢而已 提交于 2019-11-28 07:47:15
I'm currently using the RubyTidy Ruby bindings for HTML tidy to make sure HTML I receive is well-formed. Currently this library is the only thing holding me back from getting a Rails application on Ruby 1.9. Are there any alternative libraries out there that will tidy up chunks of HTML on Ruby 1.9? http://github.com/libc/tidy_ffi/blob/master/README.rdoc works with ruby 1.9 (latest version) If you are working on windows, you need to set the library_path eg require 'tidy_ffi' TidyFFI.library_path = 'lib\\tidy\\bin\\tidy.dll' tidy = TidyFFI::Tidy.new('test') puts tidy.clean (It uses the same dll

Notepad++ HTML Tidy

别等时光非礼了梦想. 提交于 2019-11-28 06:42:20
Is HTML Tidy for Notepad++ broken? None of the commands except Tidy (the first one) work. They don't show any message, even with all text selected. I really need Tidy to work, or is it just a limitation of the newest version of N++, or lack of support? Also, the custom syntax dialog freezes whenever I select a color from the color dialog. It remains unresponsive until I click one of the bold, italic, or underline checkboxes. Is this a bug? How do I fix it? All of the menu options except the first one rewrite the HTMLTIDY.CFG file, which specifies the formatting rules that HTML Tidy uses. If

DOMDocument: Ignore Duplicate Element IDs

折月煮酒 提交于 2019-11-28 03:36:31
问题 I'm putting some page content (which has been run through Tidy, but doesn't need to be if this is a source of problems) into DOMDocument using DOMDocument::loadHTML . It's coming up with various errors: ID x already defined in Entity, line X Is there any way to make either DOMDocument (or Tidy) ignore or strip out duplicate element IDs, so it will actually create the DOMDocument ? Thanks. :) 回答1: A quick search on the subject reveals this (incorrect) bug report: http://bugs.php.net/bug.php?id

How do I get HTML Tidy to not put newline before closing tags?

跟風遠走 提交于 2019-11-27 17:26:56
问题 HTML Tidy has this infuriating habit of putting a newline before the closing tag. For example: <p>Some text</p> becomes <p>Some text </p> How do I tell Tidy to keep the closing tag on the same line as the end of the content? Btw, I am running Tidy through Notepad++, if that makes any difference. 回答1: Make sure vertical-space is set to no . After much frustration I learned the only thing that switch does is screw up your already somewhat-nicely formatted html by adding newlines where you don't

PHP generated XML shows invalid Char value 27 message

岁酱吖の 提交于 2019-11-27 06:49:25
I am generating XML using PHP library as below: $dom = new DOMDocument("1.0","utf-8"); Doing above results in a page which shows a message on top of the output. This page contains the following errors: error on line 16 at column 274505: PCDATA invalid Char value 27 Below is a rendering of the page up to the first error. I have tried rectifying using Tidy library.. used iconv to get the chinese character in UTF-8. Prashant A useful function to get rid of that error is suggested on this website. http://www.phpwact.org/php/i18n/charsets#common_problem_areas_with_utf-8 When you put utf-8 encoded

An alternative to php tidy?

笑着哭i 提交于 2019-11-27 02:59:43
问题 I use php tidy to process html input in my database, $fragment = tidy_repair_string($dom->saveHTML(), array('output-xhtml'=>1,'show-body-only'=>1)); I have this php_tidy turned on in my server but my live server doesn't support tidy, Fatal error: Call to undefined function tidy_repair_string() in /customers/0/5/a/mysite.com/httpd.www/models/functions.php on line 587 Any alternative can I have to fix this problem? 回答1: I found htmLawed to be very fast. I found it when looking for an

HTML tidy/cleaning in Ruby 1.9

淺唱寂寞╮ 提交于 2019-11-27 02:03:33
问题 I'm currently using the RubyTidy Ruby bindings for HTML tidy to make sure HTML I receive is well-formed. Currently this library is the only thing holding me back from getting a Rails application on Ruby 1.9. Are there any alternative libraries out there that will tidy up chunks of HTML on Ruby 1.9? 回答1: http://github.com/libc/tidy_ffi/blob/master/README.rdoc works with ruby 1.9 (latest version) If you are working on windows, you need to set the library_path eg require 'tidy_ffi' TidyFFI

Notepad++ HTML Tidy

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 01:27:02
问题 Is HTML Tidy for Notepad++ broken? None of the commands except Tidy (the first one) work. They don't show any message, even with all text selected. I really need Tidy to work, or is it just a limitation of the newest version of N++, or lack of support? Also, the custom syntax dialog freezes whenever I select a color from the color dialog. It remains unresponsive until I click one of the bold, italic, or underline checkboxes. Is this a bug? How do I fix it? 回答1: All of the menu options except

PHP “pretty print” HTML (not Tidy)

旧街凉风 提交于 2019-11-27 01:19:23
I'm using the DOM extension in PHP to build some HTML documents, and I want the output to be formatted nicely (with new lines and indentation) so that it's readable, however, from the many tests I've done: "formatOutput = true" doesn't work at all with saveHTML(), only saveXML() Even if I used saveXML(), it still only works on elements created via the DOM, not elements that are included with loadHTML(), even with "preserveWhiteSpace = false" If anyone knows differently I'd really like to know how they got it to work. So, I have a DOM document, and I'm using saveHTML() to output the HTML. As it

PHP generated XML shows invalid Char value 27 message

眉间皱痕 提交于 2019-11-26 12:09:01
问题 I am generating XML using PHP library as below: $dom = new DOMDocument(\"1.0\",\"utf-8\"); Doing above results in a page which shows a message on top of the output. This page contains the following errors: error on line 16 at column 274505: PCDATA invalid Char value 27 Below is a rendering of the page up to the first error. I have tried rectifying using Tidy library.. used iconv to get the chinese character in UTF-8. 回答1: A useful function to get rid of that error is suggested on this website