tidy

How to best use JTidy with a Spring servlet container?

喜你入骨 提交于 2019-12-10 05:49:45
问题 I have a Java servlet container using the Spring Framework. Pages are generated from JSPs using Spring to wire everything up. The resulting HTML sent to the user isn't as, well, tidy as I'd like. I'd like to send the HTML to Tidy right before it's sent to the client browser. I'll set it up to work in development and be turned off in production; it's a winner, from my point of view, as it'll gain me more ease of maintenance. Suggestions on how to make that work cleanly in Spring? 回答1: Why do

Cleaning HTML with Nokogiri (instead of Tidy)

两盒软妹~` 提交于 2019-12-10 02:58:32
问题 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? 回答1: 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 :

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

Delete files from disk that aren't in a Visual Studio project

寵の児 提交于 2019-12-08 04:42:48
问题 Can anyone think of a way (perhaps using a PowerShell script or similar) where I can look for *.cs files that are on disk in the folder structure, but aren't included in a project file? This has come about gradually over time with merging in Subversion etc. I'm looking for a way to clean up after myself, basically. :) 回答1: All your .cs files will be mentioned in the project file, right? Scrape the XML, list the files and then do a search on the whole system. Works, but is inefficient. 回答2:

HTML Formatter in Javascript

我们两清 提交于 2019-12-08 00:59:21
问题 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

How to tidy up malformed xml in ruby

送分小仙女□ 提交于 2019-12-07 13:04:57
问题 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

No linebreak after tags in tidy

强颜欢笑 提交于 2019-12-07 09:03:30
问题 HI, I have the following input: <p>Hi <span>you</span></p> I'd like to treat this as XML. I run Tidy on the cmd-line with the following options: input-xml: yes output-xml: yes indent: no My output is this: <p>Hi <span>you</span></p> However I'd like tidy to not pretty-print the xml. I'd like it to respect all white space, and not add that line break. I can't seem to find a way to output XML without pretty-printing. Anyone know how to do this? 回答1: I had the same problem. I found a possible

JTidy Node.findBody() — How to use?

僤鯓⒐⒋嵵緔 提交于 2019-12-07 07:31:15
问题 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. 回答1: I found there's much simpler method to extract the body: tidy = new Tidy();

Delete files from disk that aren't in a Visual Studio project

耗尽温柔 提交于 2019-12-07 02:19:26
Can anyone think of a way (perhaps using a PowerShell script or similar) where I can look for *.cs files that are on disk in the folder structure, but aren't included in a project file? This has come about gradually over time with merging in Subversion etc. I'm looking for a way to clean up after myself, basically. :) All your .cs files will be mentioned in the project file, right? Scrape the XML, list the files and then do a search on the whole system. Works, but is inefficient. "Show all files" button at the top of Solution Explorer, then manually inspect? jovball The PowerShell script in my

Using Tidy2 for Notepad++

Deadly 提交于 2019-12-06 23:55:21
问题 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 回答1: 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