I keep getting <br /> in the generated HTML. It seems that HTML4 is not even supported (looking at the list of files in fckeditor/editor/dtd). Is this so, or there is a way to configure the editor to emit HTML?
mosipov wrote:There is not even one good reason to use HTML at all. XHTML is a clean, script definition. Better for humans and way better for machine processing. If FCKeditor would produce HTML, I would never use it.
I appreciate your passion for XHTML. I was hoping for a more technical reply, though.
I took a quick look at the code and it appears that there is no way to produce HTML, as the editor manipulates text elements through DOM, which serializes as XML. Those who would like to use regex to convert XHTML to HTML need to be mindful of what's in the attributes of elements that are being converted. For example, this XHTML will break most regex-based replacements: <input value="2>1"/>. So, it appears that the only safe way to convert editor output to HTML is to run it through an XML parser in the back end and use something like XSLT to produce HTML.
Have you really tried? When you insert that code you get as output <input value="2>1" /> so my suggestion is still valid, you don't need any regexp, just replace " />" with ">" and you're done.
The > character is valid in attribute values. You also cannot just replace /> without using some pattern because it may be a in a CDATA section (e.g. in a script). Anyway, you are right, in most blog-type environments simple search and replace will work just fine. I just wanted people to be aware that replacing /> without parsing XML may produce unexpected results.
Re: How can I configure the editor to emit HTML 4.1?
Re: How can I configure the editor to emit HTML 4.1?
Re: How can I configure the editor to emit HTML 4.1?
This is a reply to the post in this thread:
http://www.fckeditor.net/forums/viewtopic.php?p=24558#p24558
I appreciate your passion for XHTML. I was hoping for a more technical reply, though.
I took a quick look at the code and it appears that there is no way to produce HTML, as the editor manipulates text elements through DOM, which serializes as XML. Those who would like to use regex to convert XHTML to HTML need to be mindful of what's in the attributes of elements that are being converted. For example, this XHTML will break most regex-based replacements: <input value="2>1"/>. So, it appears that the only safe way to convert editor output to HTML is to run it through an XML parser in the back end and use something like XSLT to produce HTML.
Re: How can I configure the editor to emit HTML 4.1?
When you insert that code you get as output <input value="2>1" /> so my suggestion is still valid, you don't need any regexp, just replace " />" with ">" and you're done.
Re: How can I configure the editor to emit HTML 4.1?