[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jedit-devel
Subject:    [ jEdit-devel ] Indenter/beautifier updates (was Re: [
From:       Dale Anson <danson () grafidog ! com>
Date:       2007-06-26 5:10:53
Message-ID: 46809FDD.2060700 () grafidog ! com
[Download RAW message or body]

I made a few minor changes to both XML and Beauty plugins.  See the bug 
report below, I added an action to XML to allow the xmlindenter to split 
or unsplit attributes.  The Beauty plugin handles beautifying html, so I 
added similar functionality there.  While I was at it, I added a feature 
to Beauty that I'd been meaning to add for some time, that is, to add an 
option to have Beauty use the jEdit indenting action to indent those 
modes/files that Beauty doesn't know how to handle.  The nice thing 
about this is that now _all_ indenting/beautifying can be mapped to a 
single keyboard shortcut -- I like Ctrl-b, you might like Ctrl-i since 
that is the default shortcut for jEdit indenting.

Dale


SourceForge.net wrote:
> Feature Requests item #1741235, was opened at 2007-06-21 17:37
> Message generated for change (Comment added) made by daleanson
> You can respond by visiting: 
> https://sourceforge.net/tracker/?func=detail&atid=350588&aid=1741235&group_id=588
> 
> Please note that this message will contain a full copy of the comment thread,
> including the initial issue submission, for this request,
> not just the latest update.
> Category: plugins
> Group: None
> Status: Open
> Resolution: None
> Priority: 5
> Private: No
> Submitted By: HurricaneDavid (hurricanedavid)
> Assigned to: Nobody/Anonymous (nobody)
> Summary: XML Plugin: Separate/Join XML/HTML Tag Attributes
> 
> Initial Comment:
> In some XML and HTML code (ColdFusion as well) tags can become very long thanks to \
> many attributes, or just some long attributes. 
> This feature would split the attributes into their own line and also do the reverse \
> (i.e. join lines that are already split). 
> Possible options:
> * Allow user to choose whether or not to indent the separated lines, or to keep \
>                 them at same indention level as the first one.
> * Placement of the last ">"...
> a) Allow user to choose whether the last ">" gets put on a separate line, or is at \
> the end of the last attribute. b) Allow user to indent last ">" flush with \
> attributes or at same level as opening "<". 
> Benefits:
> * Permanent Code Alteration: When you've adopted someone else's web site, who likes \
> to keep tags in long horizontal lines, it's easy to convert that to your method, if \
>                 you like them separated.  Or vice-versa.
> * Temporary Code Viewing: For cases when you want to keep the code one way, but \
> view it temporarily in the other, then convert it back.  For instance, to see all \
> of an XML tag's attributes at once, perhaps make a small edit, then re-join them \
>                 back into one line.
> * This helps to limit horizontal scrolling, the bane of many developers.
> 
> 
> Example of "Separate" Feature:
> 
> <table cellpadding="4" cellspacing="0" border="0" width="100%" bgcolor="#eeeeee">
> 
> would become:
> 
> <table 
> cellpadding="4" 
> cellspacing="0" 
> border="0" 
> width="100%" 
> bgcolor="#eeeeee"
> 
> 
> 
> 
> Example of "Join" Feature:
> 
> <table 
> cellpadding="4" 
> cellspacing="0" 
> border="0" 
> width="100%" 
> bgcolor="#eeeeee"
> 
> 
> would become:
> 
> <table cellpadding="4" cellspacing="0" border="0" width="100%" bgcolor="#eeeeee">
> 
> 
> --
> Thank you.
> 
> 
> 
> ----------------------------------------------------------------------
> 
> 
> > Comment By: Dale Anson (daleanson)
> > 
> Date: 2007-06-25 18:07
> 
> Message:
> Logged In: YES 
> user_id=187628
> Originator: NO
> 
> Oh, okay, I didn't get that 'element granularity' part from the original. 
> What I added to xmlindenter will split the attributes out onto multiple
> lines if there is more than one element for _all_ elements.  I'll go ahead
> and add an option to xmlindenter for the toggle, but I'll leave this open. 
> I take it you're working on a feature so that when the cursor is on an
> element, you will have an action that will split out the attributes for
> just that element?
> 
> ----------------------------------------------------------------------
> 
> Comment By: Alan Ezust (ezust)
> Date: 2007-06-25 10:42
> 
> Message:
> Logged In: YES 
> user_id=935841
> Originator: NO
> 
> So you're applying it to every element in the document via xmlindenter?
> that's not exactly what was requested, although it's a nice enhancement to
> xmlindenter.
> 
> I think being able to do this on an element granularity was what was
> originally asked for...
> 
> 
> ----------------------------------------------------------------------
> 
> Comment By: Dale Anson (daleanson)
> Date: 2007-06-24 17:21
> 
> Message:
> Logged In: YES 
> user_id=187628
> Originator: NO
> 
> I added a few lines to the xmlindenter, it seems to work pretty well. 
> Right now I have the code toggling between "split" mode and "join" mode via
> a System property.  I checked this in for others to see, revision 9839. 
> Use the bean shell (Utilities - BeanShell - Evaluate BeanShell Expresion)
> to run System.setProperty("xmlindenter.splitAttributes", "true") to turn on
> the "split" mode, unset the property return to "join" mode.  Of course,
> there would need to be updates to the option pane for this if everyone
> likes this solution.  I didn't do anything about the trailing > yet.
> 
> ----------------------------------------------------------------------
> 
> Comment By: Alan Ezust (ezust)
> Date: 2007-06-24 08:40
> 
> Message:
> Logged In: YES 
> user_id=935841
> Originator: NO
> 
> There is already a "split" action, I didn't add a new action yet. I just
> made it do something sensible when you are inside a tag. Try using the
> split action now. What does it do?
> 
> Now all we need is a join, which will be trivial once I figured out how to
> get the parsed attributes from one of these many tree structure objects
> which are already in memory. 
> 
> 
> 
> ----------------------------------------------------------------------
> 
> Comment By: Dale Anson (daleanson)
> Date: 2007-06-24 06:52
> 
> Message:
> Logged In: YES 
> user_id=187628
> Originator: NO
> 
> Hi Alan,
> 
> I'm wondering if this feature wouldn't be better placed into the
> XmlIndenter rather than XML itself?
> 
> Dale
> 
> 
> ----------------------------------------------------------------------
> 
> Comment By: Alan Ezust (ezust)
> Date: 2007-06-23 16:20
> 
> Message:
> Logged In: YES 
> user_id=935841
> Originator: NO
> 
> I was trying to extract the attribute data by getting the current
> TreeNode's UserObject. But for some reason, I am unable to get the
> attribute data in XML. It appears as null. What's a good way of getting the
> attribute data of the current node? I'd rather reuse some of the parsing
> that already happened on the XML element, seeing as there is a lot of
> parsing code already there.
> 
> Dale, any ideas what I am doing wrong here?
> 
> File Added: Xml.Split-Tag.patch
> 
> ----------------------------------------------------------------------
> 
> You can respond by visiting: 
> https://sourceforge.net/tracker/?func=detail&atid=350588&aid=1741235&group_id=588
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
-- 
-----------------------------------------------
jEdit Developers' List
jEdit-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jedit-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic