htmltidy

How to keep <p><img … /></p> with XPATH?

拜拜、爱过 提交于 2019-12-11 00:58:59
问题 I use XPATH to remove untidy HTML tags, $nodeList = $xpath->query("//*[normalize-space(.)='' and not(self::br)]"); foreach($nodeList as $node) { $node->parentNode->removeChild($node); } will remove the horrible input like these, <p><em><br /></em></p> <p><span style="text-decoration: underline;"><em><br /></em></span></p> but it also removes the img tag like blow that I want to keep, <p><img title="picture summit" src="images/32913430_127001_e.jpg" alt="picture summit" width="590" height="366

Notepad++ HTML Tidy Unknown Exception Windows 7 x64

纵饮孤独 提交于 2019-12-10 19:01:26
问题 When I attempt to run HTML Tidy from the TextFX menu in NotePad++ (v5.9.3) I get the following error: Config file "C:\Program Files(x86)\Notepad++\plugins\Config\tidy\HTMLTIDY.CFG" not found! I'll pick whatever defaults I want to! After I click OK I get: "Unknown exception" and my cursor changes to the hourglass whenever I am in the document I was attempting to run HTMLTidy on. The file exists in the location specified, I have tried changing the permissions on the file so Everyone has full

Komodo Edit - HTML Reformatting / Tidy

不想你离开。 提交于 2019-12-09 04:50:21
问题 Is there a simple way to reformat my HTML from within Komodo Edit or to automate the process against Tidy? Something like the Ctrl + K , Ctrl + D in Visual Studio would be brilliant. Presently running Ubuntu with Tidy installed. 回答1: If you want a solution that just straight up works, do the following: Pop open the toolbox panel on the right Click on the gear and select New Macro, name it what you like. Get the macro code here: komodo edit macro It includes the code from http://jsbeautifier

HTML Tidy strip tags

喜欢而已 提交于 2019-12-08 13:46:20
问题 I'm working on dynamic template for bootstrap, and i'm using HTML Tidy. However it seem HTML Tidy remove specific tags, for example: <b class="caret"></b> How to supposed solve this ? my options/config is $options = array('indent' => true, 'wrap' => '300', "indent-spaces" => 4, 'clean'=>false ); Thanks.. 回答1: Also had this problem. You can add   in the tags. Html tidy will remove the tags since it thinks nothing will be displayed in any case, for example: <b class="caret"> </b> 回答2: I also

HTML Tidy, Don't move those comments!

♀尐吖头ヾ 提交于 2019-12-08 08:43:13
问题 I was working with html-tidy and a couple of my comments were moved from the head to the root of the document. Is there anyway to avoid this behavior? (I'm trying to turn some really really bad markup into xhtml complaint code) Oh and additionally it uses an in-house developed semi-server-side scripting language that uses comments to place data within the html, very, very non-standard... I'd love to completely change it over...but you know how employers are... Here is the problem: Before Tidy

How to use the HTML Tidy .NET DLL wrapper in PowerShell?

删除回忆录丶 提交于 2019-12-08 03:30:28
问题 I'm trying to use the HTML Tidy .NET wrapper in PowerShell 2.0. Here is a working example using C# (TestIt.cs included in the wrapper distribution): using Tidy; Document tdoc = new Document(); I'm doing this in PowerShell: [Reflection.Assembly]::LoadFile("C:\Users\e-t172\Desktop\Tidy.NET\Tidy.dll") New-Object Tidy.Document I get the following error: New-Object : Constructor not found. Cannot find an appropriate constructor for type Tidy.Document. At line:1 char:11 + New-Object <<<< Tidy

HTML Tidy, Don't move those comments!

大兔子大兔子 提交于 2019-12-06 15:20:20
I was working with html-tidy and a couple of my comments were moved from the head to the root of the document. Is there anyway to avoid this behavior? (I'm trying to turn some really really bad markup into xhtml complaint code) Oh and additionally it uses an in-house developed semi-server-side scripting language that uses comments to place data within the html, very, very non-standard... I'd love to completely change it over...but you know how employers are... Here is the problem: Before Tidy: <head> ... <!-- BODY_ON_LOAD_SECTION --> <script type="text/javascript" language="Javascript">

Tidying PHP and HTML Code?

老子叫甜甜 提交于 2019-12-05 16:27:21
I wonder if anyone could please help me I have been using HTML tidy and eclipses built-in function to tidy up my code. I am having great trouble with the following situations... when HTML is split between files via includes, having result structured with correct indentations helps with debugging via browser tools. PHP and HTML when used together. for example PHP if statements around HTML code where you wont the correct indentation for both the PHP and HTML. (automating this How to properly indent PHP/HTML mixed code? ) Situation one i can live with and there are ways around it. However, I

Split a html string in N parts

元气小坏坏 提交于 2019-12-04 12:08:35
问题 Does anybody have an example of spliting a html string (coming from a tiny mce editor) and splitting it into N parts using C#? I need to split the string evenly without splitting words. I was thinking of just splitting the html and using the HtmlAgilityPack to try and fix the broken tags. Though I'm not sure how to find the split point, as Ideally it should be based purley on the text rather than the html aswell. Anybody got any ideas on how to go about this? UPDATE As requested, here is an

Is there an alternative to HTML Tidy?

故事扮演 提交于 2019-12-03 11:10:53
问题 I have embedded HTML Tidy in my application to clean incoming HTML. But Tidy has a huge amount of bugs and fixing them directly in the source is my worst nightmare. Tidy source code is an unreadable abomination . Thousand+ line functions, poor variable naming, spaghetti code etc. It's truly horrible. Worse yet, official development seems to have ceased. In the last 12 months, there have been three write transactions to the official CVS repo. But it's been dead and buried for much longer than