On Mon, 3 Jun 2013 04:05:21 -0400 (EDT) [email protected] wrote: > > Hi all, > > > > Using snipMate, <h1> items have id strings that are the same as > > their text, meaning the id string has spaces. > > > > <h1 id="My h1 item">My h1 item</h1> > > > > This is an HTML4 no-no, so I want to create a Vim something or > > other so that, when my cursor is between the quotes delineating the > > id's value, it replaces all spaces with underscores. > > Ouch, making the id attribute equivalent to the contents of the text > is very bad. The id tag is suppose to be unique in a document but > there is no such restriction on text nodes that happen to be child of > a header node.
This is actually two different problems: 1) Spaces can't appear in an id string 2) <h?> text isn't guaranteed unique #1 is a showstopper and must be fixed. #2 is a minor inconvenience as long as I'm in control of the file -- I just won't let any two <h?> texts be the same, and actually, why would that happen in normal authoring? Truth be told, I've *always* algorithmically let the id be based on the text -- Netscape Composer, NVU and Kompozer did this as well. It's a huge convenience because you can tell at a glance what to link to, and a tiny inconvenience in that you need to handle situations where two <h?> lines contain the same visible text. I fixed problem #1 as described in a prior email, although I just realized my map must also remove all punctuation, which is just another replace just like the space to underscore replacement. > > snipMate (I've never used it) should either not provide an id > attribute or if you want one, ask you to provide the string to use. > There really isn't a need for headers to have id attribute in most > cases, really they are only needed if you plan to use JS to modify it > in which case using the original string is even a worse idea. In my > idea. You can link to id= text in your table of contents, instead of using <a name= labels. I'm not sure if that's the preferred way to do things -- I'll need to look it up. > > I would file a bug report with snipMate if I used that product, that's > just poorly done IMHO. I think you're right, I'll do that, and I'll submit my blank to underscore thing so maybe they can just put that in. Thanks, SteveT Steve Litt * http://www.troubleshooters.com/ Troubleshooting Training * Human Performance -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
