I copied the line
- Code: Select all
<div> <div> <a href="#">Hello</a> <ul> <li> <a>Dropdown <b></b></a> </li> <li> <a>Dropdown 2 <b></b></a> </li> </ul> </div></div>
into a new ASCII/ANSI file (no Unicode encoding like UTF-8) with DOS line terminates and saved the file as Test.htm. The save activated syntax highlighting for HTML as indicated in the status bar. Next I executed
XML Convert to CR/LFs and the output was:
- Code: Select all
<div>
<div>
<a href="#">Hello</a>
<ul>
<li>
<a>Dropdown <b></b>
</a>
</li>
<li>
<a>Dropdown 2 <b></b>
</a>
</li>
</ul>
</div>
</div>
I have configured for files with file extension HTM and HTML to use spaces in place of tabs and use 1 space as indent space.
The result is perfect. That's exactly what I expected, but what I would never like for HTML/XHTML files.
The command
XML Convert to CR/LFs automatically reindents all lines. So there is no need to execute additionally command
ReIndent Selection.
I have nevertheless selected this block and executed the command
ReIndent Selection. There was no change as expected by me.
Next I used the commands
File - Revert to Saved and
File - Rename File to restore previous single line and rename the file to Test.xml. Then I executing once more
Revert to Saved to trigger highlighting as XML instead of HTML file.
Now I executed once again command
XML Convert to CR/LFs and got as output:
- Code: Select all
<div>
<div>
<a href="#">Hello</a>
<ul>
<li>
<a>Dropdown <b></b>
</a>
</li>
<li>
<a>Dropdown 2 <b></b>
</a>
</li>
</ul>
</div>
</div>
I have configured for files with file extension XML to use tabs with a tab stop/indent value of 3.
Yes, this result is not what can be expected. Either the output should be like above on running the command on the HTML file or <b></b> should be twice indented on a new line and the result is:
- Code: Select all
<div>
<div>
<a href="#">Hello</a>
<ul>
<li>
<a>Dropdown
<b></b>
</a>
</li>
<li>
<a>Dropdown 2
<b></b>
</a>
</li>
</ul>
</div>
</div>
I have used the standard wordfiles as installed with UES v12.20.0.1002 where
html.uew contains
/Indent Strings = "<"
/Unindent Strings = "</"and
xml.uew contains no indent/unindent strings definitions. Therefore I added to the
xml.uew the 2 lines as present in
html.uew, restarted UEStudio and executed the command
XML Convert to CR/LFs once again on Test.xml. Now the result was:
- Code: Select all
<div>
<div>
<a href="#">Hello</a>
<ul>
<li>
<a>Dropdown <b></b>
</a>
</li>
<li>
<a>Dropdown 2 <b></b>
</a>
</li>
</ul>
</div>
</div>
That's a much better because one of the 2 possible correct results.
Next I copied into Test.xml additionally the line
- Code: Select all
<a><b><c/><d>oh no!</d></b></a>
and executed the conversion command again. The result for this block as like what you posted. The reindent failed starting on the empty element.
Therefore I modified the unindent strings definition line to
/Unindent Strings = "</" "/>"as I suggested in the topic you referenced, saved
xml.uew, restarted UES and re-opened Test.xml. I executed command
XML Convert to CR/LFs and now both lines are correct reformatted to:
- Code: Select all
<div>
<div>
<a href="#">Hello</a>
<ul>
<li>
<a>Dropdown <b></b>
</a>
</li>
<li>
<a>Dropdown 2 <b></b>
</a>
</li>
</ul>
</div>
</div>
<a>
<b>
<c/>
<d>oh no!</d>
</b>
</a>
Of course reverting the file content to saved, renaming it to Test.htm, executing once more
Revert to Saved to trigger highlighting as HTML instead of XML file and executing
XML Convert to CR/LFs resulted in same wrong indentations for the second line as before on XML because of the empty element and
"/>" not present in
html.uew as unindent string.