submitted in HTML format and sent to a server that performs some preliminary processing.
It works with the "src" attribute of the "img" tag.
After pre-processing and saving, all pre-processed "img" tags are not self-closing.
For example, if the tag "img" was checked:
<img src="image.png" />
after pre-processing with Nokogiri or Hpricot, this will be:
<img src="/preprocessed_path/image.png">
The code is pretty simple:
doc = Hpricot(self.content)
doc.search("img").each do |tag|
preprocess tag
end
self.content = doc.to_html
For Nokorigi, it looks the same.
How to solve this problem?
Update 1
Forget noting - I have an HTML 5 page that I'm trying to test with the W3C Validator .
When the "img" tag is inside a div, it complains about the following:
required character (found d) (expected i)
</div>
For example, try checking the following code:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
</head>
<body>
<div>
<img src="image.png">
</div>
</body>
</html>
You will get the same error:
Line 9, Column 4: required character (found d) (expected i)
</div>