Page 1 of 1

Format for XHTML

Posted: Mon Jul 28, 2008 9:01 am
by jelovirt
Would it be possible to add an option to formatting XHTML, that would override the other formatting options and use formatting that makes sense for XHTML. That is, when the root element of the document is "html" in namespace "http://www.w3.org/199/xhtml", for empty elements like <br> the option "Add space before slash in empty elements" is set, and for element like <script> option "Expand empty elements" is set.

Re: Format for XHTML

Posted: Wed Jul 30, 2008 10:55 am
by sorin_ristache
Hello,
jelovirt wrote:for empty elements like <br> the option "Add space before slash in empty elements" is set, and for element like <script> option "Expand empty elements" is set.
We will consider adding an option for applying special formatting rules in XHTML documents. Do you have other suggestions for XHTML formatting rules?


Thank you,
Sorin

Re: Format for XHTML

Posted: Wed Jul 30, 2008 1:37 pm
by jelovirt
sorin wrote: We will consider adding an option for applying special formatting rules in XHTML documents. Do you have other suggestions for XHTML formatting rules?
Thank you. I think the best source for rules is http://www.w3.org/TR/xhtml1/#guidelines, namely C.2 and C.3.

Re: Format for XHTML

Posted: Wed Jul 30, 2008 2:59 pm
by sorin_ristache
Other rules that I can find there and that apply to an XHTML formatting operation are:
  • avoid line breaks and multiple white space characters within attribute values
  • use ' instead of &apos; to work as expected in HTML 4 user agents
  • use both the lang and xml:lang attributes when specifying the language of an element

Regards,
Sorin

Re: Format for XHTML

Posted: Thu Jul 31, 2008 10:22 am
by jelovirt
sorin wrote:Other rules that I can find there and that apply to an XHTML formatting operation are:
  • avoid line breaks and multiple white space characters within attribute values
  • use ' instead of &apos; to work as expected in HTML 4 user agents
  • use both the lang and xml:lang attributes when specifying the language of an element
While those can be done in the "indent and format" operation, I'd consider those to be something that e.g. HTMLTidy would do and it's not just formatting anymore. If you do implement these above, there should be a preference for tidying the document. Something that would go in line with above changes, is turning

Code: Select all

<script type="text/javascript">
for (var i = 0; i < 10; i++) {
alert(i);
}
</script>
to

Code: Select all

<script type="text/javascript">
//<![CDATA[
for (var i = 0; i < 10; i++) {
alert(i);
}
//]]>
</script>
Maybe there should be an option to run HTMLTidy for a XHMTL file currently open, without any formatting by HTMLTidy and then let Oxygen take care of the indenting.

Re: Format for XHTML

Posted: Fri Aug 01, 2008 12:08 pm
by sorin_ristache
jelovirt wrote:Maybe there should be an option to run HTMLTidy for a XHMTL file currently open, without any formatting by HTMLTidy and then let Oxygen take care of the indenting.
You can run a HTMLTidy command line as an external tool in Oxygen. External tools are defined in Preferences -> External Tools and are available on the toolbar External Tools.


Regards,
Sorin