G;day all,
I'm an infrequent TM user, as I spend 90% of my time in FileMaker Pro, but do some occasional work in XSLT. I was wondering if someone could help with an issue with indenting in XML. I've got some code that looks like the following as output in XML :
<Style> <Data>Some text Here.</Data> </Style> <Style> <Data>Some text Here. Some more text here.</Data> </Style>
This has been indented using the "Indent Selection" option. Obviously I'd like it to work the same on the second set of text as it does on the first. I'm told you can change this via the bundle, but grep and regex are like greek to me. Is this something I can modify, or this maybe intended behaviour?
Thanks, Nick
On 2 Apr 2007, at 07:11, Nicholas Orr wrote:
<Style> <Data>Some text Here.</Data> </Style>
<Style> <Data>Some text Here. Some more text here.</Data> </Style>
That is a somewhat odd way of indenting XML. The normal way is to either have everything on one line (as in your first Data tag) or have the tags and content on separate lines, like so:
<Style> <Data>Some text Here.</Data> </Style> <Style> <Data> Some text Here. Some more text here. </Data> </Style>
This way it will also be indented properly by TM.
On 2007/04/02, at 08:46, Ciarán Walsh wrote:
On 2 Apr 2007, at 07:11, Nicholas Orr wrote:
<Style> <Data>Some text Here.</Data> </Style>
<Style> <Data>Some text Here. Some more text here.</Data> </Style>
That is a somewhat odd way of indenting XML. The normal way is to either have everything on one line (as in your first Data tag) or have the tags and content on separate lines, like so:
<Style> <Data>Some text Here.</Data> </Style>
<Style> <Data> Some text Here. Some more text here. </Data> </Style>
This way it will also be indented properly by TM.
Actually, your text data should be inserted within CDATA
<![CDATA[Some text here. Some more text here.]]>
-- Igor Sutton igor.sutton@gmail.com
On 02/04/2007, at 5:46 PM, Ciarán Walsh wrote:
On 2 Apr 2007, at 07:11, Nicholas Orr wrote:
<Style> <Data>Some text Here.</Data> </Style>
<Style> <Data>Some text Here. Some more text here.</Data> </Style>
That is a somewhat odd way of indenting XML. The normal way is to either have everything on one line (as in your first Data tag) or have the tags and content on separate lines, like so:
<Style> <Data>Some text Here.</Data> </Style>
<Style> <Data> Some text Here. Some more text here. </Data> </Style>
This way it will also be indented properly by TM.
Yes, I realise that. However that's the data I've got, and it's generated that way as a fixed entity, so it's not something I can change right now.
I've put in a bug report that the data should be contained in a CDATA section, which would hopefully avoid the issue.
In the mean time, the question still stands, is there any way to adjust TM so that it wraps it for me?
Thanks, Nick
On 2 Apr 2007, at 10:07, Nicholas Orr wrote:
In the mean time, the question still stands, is there any way to adjust TM so that it wraps it for me?
You could edit the language syntax if you really wanted to (but I suspect that you don't). Some alternatives: • make a find/replace macro to drop the trailing tag onto the next line, so that the standard indent will work • if your document is well-formatted, the Tidy command (XML→Tidy or ⌃⇧H) should indent it for you
On 02/04/2007, at 8:19 PM, Ciarán Walsh wrote:
On 2 Apr 2007, at 10:07, Nicholas Orr wrote:
In the mean time, the question still stands, is there any way to adjust TM so that it wraps it for me?
You could edit the language syntax if you really wanted to (but I suspect that you don't).
That was my first guess, I was hoping someone could assist me there...
Some alternatives: • make a find/replace macro to drop the trailing tag onto the next line, so that the standard indent will work
The problem is that some of the tags are single lines, some are doubles, and it's spread across multiple different tags, not just in one place.
• if your document is well-formatted, the Tidy command (XML→Tidy or ⌃⇧H) should indent it for you
I will give that a try. I noticed there was an update to the xml bundle to stop it replacing the document with the error, so that will make it more useful.
Cheers, Nick
Hi Nick,
<Style> <Data>Some text Here.</Data> </Style>
<Style> <Data>Some text Here. Some more text here.</Data> </Style>
This has been indented using the "Indent Selection" option. Obviously I'd like it to work the same on the second set of text as it does on the first.
I'd really love to see the XML-bundle do the indentation as you describe. For XML I still use emacs; XML handling is not really one of TextMate's best sides. Putting the data into CDATA section can't be a serious suggestion.
Patrick