From mike@screenflicker.com Sat Jun 9 18:26:10 2007 From: Mike Stickel To: textmate@lists.macromates.com Subject: [TxMt] Regex to indent new lines between tags Date: Sat, 09 Jun 2007 11:26:08 -0700 Message-ID: <9C91EFFA-D97D-44EA-A3B3-47CA4A665683@screenflicker.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5846238726950284872==" --===============5846238726950284872== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit For a project I'm working one I'm trying to figure out a way to tab indent new lines of code between certain tags (mainly and ). Unfortunately I'm not as good at regular expressions as I thought I was and can't figure it out. Anyone out there able to lend a hand? Thanks, Mike Stickel http://screenflicker.com/mike/ | http://gonecksgo.com --===============5846238726950284872== Content-Type: text/html Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="attachment.htm" MIME-Version: 1.0 PEhUTUw+PEJPRFkgc3R5bGU9IndvcmQtd3JhcDogYnJlYWstd29yZDsgLWtodG1sLW5ic3AtbW9k ZTogc3BhY2U7IC1raHRtbC1saW5lLWJyZWFrOiBhZnRlci13aGl0ZS1zcGFjZTsgIj48RElWPkZv ciBhIHByb2plY3QgSSdtIHdvcmtpbmcgb25lIEknbSB0cnlpbmcgdG8gZmlndXJlIG91dCBhIHdh eSB0byB0YWIgaW5kZW50IG5ldyBsaW5lcyBvZiBjb2RlIGJldHdlZW4gY2VydGFpbiB0YWdzICht YWlubHkgJmx0O2hlYWQmZ3Q7IGFuZCAmbHQ7Ym9keSZndDspLiBVbmZvcnR1bmF0ZWx5IEknbSBu b3QgYXMgZ29vZCBhdCByZWd1bGFyIGV4cHJlc3Npb25zIGFzIEkgdGhvdWdodCBJIHdhcyBhbmQg Y2FuJ3QgZmlndXJlIGl0IG91dC48L0RJVj48RElWPjxCUiBjbGFzcz0ia2h0bWwtYmxvY2stcGxh Y2Vob2xkZXIiPjwvRElWPjxESVY+QW55b25lIG91dCB0aGVyZSBhYmxlIHRvIGxlbmQgYSBoYW5k PzwvRElWPjxESVY+PEJSIGNs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wtdGV4dC1kZWNvcmF0aW9ucy1pbi1lZmZlY3Q6IG5vbmU7 IHRleHQtaW5kZW50OiAwcHg7IC1hcHBsZS10ZXh0LXNpemUtYWRqdXN0OiBhdXRvOyB0ZXh0LXRy YW5zZm9ybTogbm9uZTsgb3JwaGFuczogMjsgd2hpdGUtc3BhY2U6IG5vcm1hbDsgd2lkb3dzOiAy OyB3b3JkLXNwYWNpbmc6IDBweDsgIj48RElWPk1pa2UgU3RpY2tlbDwvRElWPjxESVY+PEEgaHJl Zj0iaHR0cDovL3NjcmVlbmZsaWNrZXIuY29tL21pa2UvIj5odHRwOi8vc2NyZWVuZmxpY2tlci5j b20vbWlrZS88L0E+IHwgPEEgaHJlZj0iaHR0cDovL2dvbmVja3Nnby5jb20iPmh0dHA6Ly9nb25l Y2tzZ28uY29tPC9BPjwvRElWPjxCUiBjbGFzcz0iQXBwbGUtaW50ZXJjaGFuZ2UtbmV3bGluZSI+ PC9TUEFOPjwvU1BBTj4gPC9ESVY+PEJSPjwvQk9EWT48L0hUTUw+ --===============5846238726950284872==-- From throw-away-1@macromates.com Sun Jun 10 08:57:53 2007 From: Allan Odgaard To: textmate@lists.macromates.com Subject: Re: [TxMt] Regex to indent new lines between tags Date: Sun, 10 Jun 2007 10:57:48 +0200 Message-ID: In-Reply-To: <9C91EFFA-D97D-44EA-A3B3-47CA4A665683@screenflicker.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1629913833973025874==" --===============1629913833973025874== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On 9. Jun 2007, at 20:26, Mike Stickel wrote: > For a project I'm working one I'm trying to figure out a way to tab > indent new lines of code between certain tags (mainly and > ). Unfortunately I'm not as good at regular expressions as I > thought I was and can't figure it out. > > Anyone out there able to lend a hand? Exactly when do you want what to happen? If you have the following: bla bla bla bla Then select it and use Text → Indent Selection (⌥⌘[]) then you get: bla bla bla bla Is this the functionality you are after? --===============1629913833973025874==-- From mike@screenflicker.com Sun Jun 10 16:04:18 2007 From: Mike Stickel To: textmate@lists.macromates.com Subject: Re: [TxMt] Regex to indent new lines between tags Date: Sun, 10 Jun 2007 09:04:05 -0700 Message-ID: <6E3F39EF-1F7F-41F5-8704-21B49FE00663@screenflicker.com> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4613410150735222475==" --===============4613410150735222475== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On Jun 10, 2007, at 1:57 AM, Allan Odgaard wrote: >> For a project I'm working one I'm trying to figure out a way to >> tab indent new lines of code between certain tags (mainly >> and ). Unfortunately I'm not as good at regular expressions >> as I thought I was and can't figure it out. >> >> Anyone out there able to lend a hand? > > Exactly when do you want what to happen? > > If you have the following: > > > bla bla > > > > bla bla > > > Then select it and use Text → Indent Selection (⌥⌘[]) then you > get: > > > bla bla > > > > bla bla > > > Is this the functionality you are after? That's what I have been doing but I was wondering if there was a way to do it with the search and replace dialog using regular expressions to replace all the \n with \n\t to get that indent Mike Stickel http://screenflicker.com/mike/ | http://gonecksgo.com --===============4613410150735222475==-- From ciawal@gmail.com Sun Jun 10 16:07:24 2007 From: =?utf-8?q?Ciar=C3=A1n?= Walsh To: textmate@lists.macromates.com Subject: Re: [TxMt] Regex to indent new lines between tags Date: Sun, 10 Jun 2007 17:07:11 +0100 Message-ID: <6AA95092-1AC1-4AC2-98C0-EC178C5EBB2D@gmail.com> In-Reply-To: <6E3F39EF-1F7F-41F5-8704-21B49FE00663@screenflicker.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7909407229006324737==" --===============7909407229006324737== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On 10 Jun 2007, at 17:04, Mike Stickel wrote: > I was wondering if there was a way to do it with the search and > replace dialog using regular expressions to replace all the \n with > \n\t to get that indent Sure there is, that's it. But why? --===============7909407229006324737== Content-Type: text/html Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="attachment.htm" MIME-Version: 1.0 PEhUTUw+PEJPRFkgc3R5bGU9IndvcmQtd3JhcDogYnJlYWstd29yZDsgLWtodG1sLW5ic3AtbW9k ZTogc3BhY2U7IC1raHRtbC1saW5lLWJyZWFrOiBhZnRlci13aGl0ZS1zcGFjZTsgIj48RElWPjxE SVY+T24gMTAgSnVuIDIwMDcsIGF0IDE3OjA0LCBNaWtlIFN0aWNrZWwgd3JvdGU6PC9ESVY+PEJS IGNsYXNzPSJBcHBsZS1pbnRlcmNoYW5nZS1uZXdsaW5lIj48QkxPQ0tRVU9URSB0eXBlPSJjaXRl Ij48UCBzdHlsZT0ibWFyZ2luOiAwLjBweCAwLjBweCAwLjBweCAwLjBweCI+PEZPTlQgZmFjZT0i THVjaWRhIEdyYW5kZSIgc2l6ZT0iMyIgc3R5bGU9ImZvbnQ6IDEyLjBweCBMdWNpZGEgR3JhbmRl Ij5JIHdhcyB3b25kZXJpbmcgaWYgdGhlcmUgd2FzIGEgd2F5IHRvIGRvIGl0IHdpdGggdGhlIHNl YXJjaCBhbmQgcmVwbGFjZSBkaWFsb2cgdXNpbmcgcmVndWxhciBleHByZXNzaW9ucyB0byByZXBs YWNlIGFsbCB0aGUgXG4gd2l0aCBcblx0IHRvIGdldCB0aGF0IGluZGVudDwvRk9OVD48L1A+IDwv QkxPQ0tRVU9URT48L0RJVj5TdXJlIHRoZXJlIGlzLCB0aGF0J3MgaXQuIEJ1dCB3aHk/PEJSPjwv Qk9EWT48L0hUTUw+ --===============7909407229006324737==-- From throw-away-1@macromates.com Sun Jun 10 16:15:14 2007 From: Allan Odgaard To: textmate@lists.macromates.com Subject: Re: [TxMt] Regex to indent new lines between tags Date: Sun, 10 Jun 2007 18:15:11 +0200 Message-ID: <556550A3-C0EC-4884-8D98-FCE5289B6368@macromates.com> In-Reply-To: <6E3F39EF-1F7F-41F5-8704-21B49FE00663@screenflicker.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8940350655032012173==" --===============8940350655032012173== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On 10. Jun 2007, at 18:04, Mike Stickel wrote: > [...] > That's what I have been doing but I was wondering if there was a > way to do it with the search and replace dialog using regular > expressions to replace all the \n with \n\t to get that indent So you want to re-indent your HTML solely by running a single regexp replace? This is not possible -- why is that restraint necessary? --===============8940350655032012173==-- From mike@screenflicker.com Sun Jun 10 18:31:05 2007 From: Mike Stickel To: textmate@lists.macromates.com Subject: Re: [TxMt] Regex to indent new lines between tags Date: Sun, 10 Jun 2007 11:31:03 -0700 Message-ID: In-Reply-To: <556550A3-C0EC-4884-8D98-FCE5289B6368@macromates.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2356895392293550880==" --===============2356895392293550880== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit >> [...] >> That's what I have been doing but I was wondering if there was a >> way to do it with the search and replace dialog using regular >> expressions to replace all the \n with \n\t to get that indent > > So you want to re-indent your HTML solely by running a single > regexp replace? > > This is not possible -- why is that restraint necessary? I'm going through multiple updates on a very large site. There is already a series of search and replaces that I'm doing on these files. In order to format the existing code a little better I was hoping I could just use another search and replace instead of selecting the code and using the indent command. If there's no way to do it then it's no big deal, I was just curious. Mike Stickel http://screenflicker.com/mike/ | http://gonecksgo.com --===============2356895392293550880==-- From ciawal@gmail.com Sun Jun 10 18:38:01 2007 From: =?utf-8?q?Ciar=C3=A1n?= Walsh To: textmate@lists.macromates.com Subject: Re: [TxMt] Regex to indent new lines between tags Date: Sun, 10 Jun 2007 19:37:49 +0100 Message-ID: <31F7BCC5-4ADB-443B-8DDE-9DE807674B87@gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2106409078861962466==" --===============2106409078861962466== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On 10 Jun 2007, at 19:31, Mike Stickel wrote: >>> [...] >>> That's what I have been doing but I was wondering if there was a >>> way to do it with the search and replace dialog using regular >>> expressions to replace all the \n with \n\t to get that indent >> >> So you want to re-indent your HTML solely by running a single >> regexp replace? >> >> This is not possible -- why is that restraint necessary? > > I'm going through multiple updates on a very large site. There is > already a series of search and replaces that I'm doing on these > files. In order to format the existing code a little better I was > hoping I could just use another search and replace instead of > selecting the code and using the indent command. > > If there's no way to do it then it's no big deal, I was just curious. Maybe use Tidy and a bash script --===============2106409078861962466==-- From isd@strangetower.com Mon Jun 11 01:50:42 2007 From: Ian Smith-Dahl To: textmate@lists.macromates.com Subject: Re: [TxMt] Regex to indent new lines between tags Date: Sun, 10 Jun 2007 21:50:37 -0400 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7633761509556785857==" --===============7633761509556785857== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On Jun 10, 2007, at 2:31 PM, Mike Stickel wrote: > > I'm going through multiple updates on a very large site. There is > already a series of search and replaces that I'm doing on these > files. In order to format the existing code a little better I was > hoping I could just use another search and replace instead of > selecting the code and using the indent command. If your html head is relatively simple you may be able to do it with negative matches on your regexp. For example, if you have: <meta ... > <style ...> </head> <body> ... </body> </html> You could replace all newlines that *don't* start with those 9 strings I'm not sure I have the syntax right here, but something along these lines: find: ^^[</{0,1}html>|</{0,1}head>|<title>|<meta|<style|</{0,1}body>] (.*) replace: \t$1 --===============7633761509556785857==--