Home Download Buy Blog Forum Support

TagIndent

TagIndent

Postby tito on Sun Oct 09, 2011 11:55 pm

EDIT : Use Tag Package instead.

I was unable to find a solution to format simple bits of HTML/XML/RDF/XUL ( some invalid ), then I created "TagIndent" plugin:

Apply and/or add beauty indentation to HTML/XML/RDF/XUL tags found on selection(s).


Usage
There is a context menu item called "Indent Tags on Selection"
There is also a Main menuitem: Edit -> Tag -> "Indent Tags on Selection".
There is also a command called "Indent Tags on Selection".

Aims
Aims to add and/or apply correct indentation to little portions of HTML or XML, not to complete documents.

Information
It takes the starting "indentation level" from the first line of each selection and sums tabs as needed.
On empty tags, and on tags with less than 40 characters, it writes the tag in one line.
Short-cut is "ctrl+shift+h"

Source / Installation
https://github.com/SublimeText/TagIndent

Update:
- Repository moved to SublimeText Organization at github.
- Support self closing tags.
Last edited by tito on Thu Dec 29, 2011 1:28 pm, edited 2 times in total.
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 706
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: TagIndent

Postby skaet on Mon Oct 10, 2011 2:17 pm

Handy :)

I often review and clean up code from our front-end designer who, for some reason, doesn't bother with well-formed code like adhering to a common standard of tabs vs spaces between documents and sometimes even varies from 4 spaces to 2 spaces to tabs in a single document!
skaet
 
Posts: 93
Joined: Thu Sep 16, 2010 3:37 pm

Re: TagIndent

Postby firefusion on Thu Oct 13, 2011 5:19 am

Very nice!

One problem is it seems to move my end of div comments around though. This...

Code: Select all
</div><!-- .overlay -->


Becomes this...

Code: Select all
<!-- .overlay --></div>
firefusion
 
Posts: 218
Joined: Fri Oct 16, 2009 7:37 am

Re: TagIndent

Postby tito on Thu Oct 13, 2011 7:18 am

I can't repro with that little information...

I know this:
Code: Select all
<div></div><!-- end -->

Become this:
Code: Select all
<div></div>
<!-- end -->

But not what you described, a move of a tag inside another.
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 706
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: TagIndent

Postby msthmnd on Thu Dec 29, 2011 7:37 am

hi tito, if there's a php on top of <!doctype, it indents the doctype,

it also indents these:

Code: Select all
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->


to this:

Code: Select all
<html class="no-js ie6 oldie" lang="en">
    <![endif]--><!--[if IE 7]>
    <html class="no-js ie7 oldie" lang="en">
      <![endif]--><!--[if IE 8]>
      <html class="no-js ie8 oldie" lang="en">
        <![endif]--><!--[if gt IE 8]><!-->
        <html class="no-js" lang="en"><!--<![endif]-->
msthmnd
 
Posts: 17
Joined: Mon Aug 22, 2011 2:40 am

Re: TagIndent

Postby tito on Thu Dec 29, 2011 1:17 pm

Hi, sorry is not perfect.

The idea is to apply source formatting on easy portions of HTML documents, not entire documents.

Also if someone want to re-write or add a better implementation of "tag indent" please do it on "tag" package, then we don't end with 5 packages with does the same thing.
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 706
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: TagIndent

Postby willy1234x1 on Fri Dec 30, 2011 7:21 am

Could you add this to package manager? :) That would be awesome
Take a look at how! http://wbond.net/sublime_packages/packa ... developers
willy1234x1
 
Posts: 31
Joined: Thu Dec 22, 2011 7:55 am

Re: TagIndent

Postby tito on Fri Dec 30, 2011 8:22 pm

This package is from some time ago mixed with "Tag" package. Available from "Package Control"
https://github.com/SublimeText/Tag
Regards,
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 706
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay


Return to Plugin Announcements

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests

cron