0

I would like to make a snippet that makes an HTML table.

Here are some examples of things to type :

table name address city - table team wins losses draws - table views clicks clickthrough

This is what I want it to output : a table with a columns for each of the fields (with 'table' triggering the snippet).

I'd also like to run these field names through a function to transform them (for example to field names - "First Name" -> 'first_name'.

Is this possible? How would I do it?

3
  • I didn't get the first question but "First Name" -> "first_name" is CaseConversion plugins' job Commented Jul 12, 2013 at 8:05
  • I mean I want to type 'table city address state' and have it expand into an html table where the row says 'city' 'address' and 'state' in each cell. Commented Jul 12, 2013 at 13:33
  • From what I've seen, you can't do loops in snippets, you could in a python plugin, however. But, there is probably a better way to accomplish what you are trying to do. Commented Jul 21, 2013 at 0:17

1 Answer 1

1

Not exactly what you want, but I would go with Emmet (here is a handy cheet sheet). There is a Sublime package available, so it's easy to install. It might be a little overwhelming at first, but once you start to use it, you will get the hang of it and it will speed up your html/css production.

Type table>tr*3>th and hit tab at the end. This will produce:

<table>
  <tr>
    <th></th>
  </tr>
  <tr>
    <th></th>
  </tr>
  <tr>
    <th></th>
  </tr>
</table>

Then you can tab to the ths to type in your column headers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.