Format for XHTML

Are you missing a feature? Request its implementation here.
jelovirt
Posts: 84
Joined: Tue Oct 11, 2005 9:17 am
Location: Helsinki, Finland
Contact:

Format for XHTML

Post 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.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Format for XHTML

Post 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
jelovirt
Posts: 84
Joined: Tue Oct 11, 2005 9:17 am
Location: Helsinki, Finland
Contact:

Re: Format for XHTML

Post 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.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Format for XHTML

Post 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
jelovirt
Posts: 84
Joined: Tue Oct 11, 2005 9:17 am
Location: Helsinki, Finland
Contact:

Re: Format for XHTML

Post 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.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Format for XHTML

Post 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
Post Reply