tidy

Problems Indenting HTML(5) with PHP

这一生的挚爱 提交于 2021-02-19 05:52:47
问题 Disclaimer: Please bare with the length of this question. This is a recurring question for a real world problem that I've seen asked hundreds of times with no clear, working solution ever being presented. I have hundreds of HTML files I want to mass indent using PHP. At first I thought of using Tidy but as you should know, it's not compatible by default with HTML5 tags and attributes, after some research and even more tests I came up with the following implementation that "fakes" HTML 5

tidying html with ckeditor

℡╲_俬逩灬. 提交于 2020-02-22 05:25:43
问题 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

.NET version of HTML Tidy?

本秂侑毒 提交于 2020-01-15 06:30:12
问题 Does anyone know if there's a native port of HTML Tidy available for .NET? In Sourceforge, there's a TidyNet project - which hasn't been updated since 2005 and seems like a wrapper only. Java port seems to exist as recent JTidy project. HTML Tidy project page: http://tidy.sourceforge.net/ 回答1: You are right, the Tidy.NET hasn't been updated in a while. An alternative is TidyForNet Links on that page to the source code in SVN. "This wrapper is based upon a wrapper provided by Adrian Bateman

Tidy for Jinja2 templates

冷暖自知 提交于 2020-01-03 07:18:50
问题 Is there a tidy-like tool or a tidy configuration, which works fine with Jinja2 templates? The default tidy has problems with Jinja code in attributes and Jinja-loops are formated in an unreadable way. My main requirement is to get the indentation level right. Everything else is nice to have, but not required. 回答1: You probably want a standalone tool and your question is old, so you've probably already solved it, but just in case this could be helpful. Some editors can handle jinja indent.

How can I get the error/warning messages out of the parsed HTML using JTidy?

做~自己de王妃 提交于 2020-01-02 11:06:15
问题 I am able to parse the HTML but I want to extract the warning messages from the parsed HTML and show them to the user. Here is my code: Tidy tidy = new Tidy(); StringBuffer StringBuffer1 = new StringBuffer("<b>Hello<u><b>I am tsting another one.....<i>another....."); InputStream in = new ByteArrayInputStream(StringBuffer1.toString().getBytes("UTF-8")); Writer stringWriter = new StringWriter(); tidy.setPrintBodyOnly(true); tidy.setQuiet(true); tidy.setShowWarnings(true); tidy.setTidyMark(false

Php Tidy : remove link and style tags inside body

狂风中的少年 提交于 2019-12-29 09:32:09
问题 I must cleanup some HTML code to remove <style> and <link> tags inside the <body> tag. I'm already using PHP Tidy to do some cleanup but I did not found how to remove those tags with PHP Tidy. Do you have a solution ? Or maybe another markup cleaner PHP class... 回答1: Don't know how to do that with Tidy, but you can use DOM $dom = new DOMDocument; // init new DOMDocument $dom->loadHTML($html); // load HTML into it $xpath = new DOMXPath($dom); // create a new XPath $nodes = $xpath->query('/

Php Tidy : remove link and style tags inside body

纵然是瞬间 提交于 2019-12-29 09:31:40
问题 I must cleanup some HTML code to remove <style> and <link> tags inside the <body> tag. I'm already using PHP Tidy to do some cleanup but I did not found how to remove those tags with PHP Tidy. Do you have a solution ? Or maybe another markup cleaner PHP class... 回答1: Don't know how to do that with Tidy, but you can use DOM $dom = new DOMDocument; // init new DOMDocument $dom->loadHTML($html); // load HTML into it $xpath = new DOMXPath($dom); // create a new XPath $nodes = $xpath->query('/

⌃⇧H in TextMate to 'Tidy' HTML causes NoMethodError

余生颓废 提交于 2019-12-24 05:06:08
问题 I tried using 'Tidy' in an HTML document for the first time yesterday, and got... /tmp/temp_textmate.Z2P0KX:30:in `<main>': undefined method `empty?' for nil:NilClass (NoMethodError) I've not done anything to the code in the bundle... #!/usr/bin/env ruby -wKU require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb' require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes.rb' result = `"${TM_TIDY:-tidy}" -f /tmp/tm_tidy_errors -iq -utf8 \ -wrap 0 --tab-size $TM_TAB_SIZE --indent-spaces $TM_TAB_SIZE \ --indent