Posts mit dem Label jedit cucumber macro werden angezeigt. Alle Posts anzeigen
Posts mit dem Label jedit cucumber macro werden angezeigt. Alle Posts anzeigen

Dienstag, 5. April 2011

JEdit macro to beautify/ align text tables (ex. as used in cucumber scenarios)

For quite some time now I'm using cucumber for behavior driven ruby on rails development (BDD). And I use the nice text tables in my scenarios cucumber offers. Too bad I couldn't find a macro/ plugin which allows me to easily align the table cells so they look nice and well formated.

This this is how I write my tables:

  |Corin|Langosch|info@netskin.com|
  |Hans|Müller|test@email.com|

This is how they should look like:
  | Corin | Langosch | info@netskin.com |
  | Hans  | Müller   | test@email.com   |

After having a short look on how to write macros for jedit I turned out the be real easy, due to the use of beanshell. So here it is: my jedit macro to beautify text tables

How to install
  1. Download the file.
  2. Copy it to your .jedit/macros folder. You can also create a subfolder "Text" and place it there.
  3. Open jedit and select Macros / Rescan Macros.
  4. You should see a macro called "Beautify Table" now.
How to use
  1. Write your text table in jedit as you normally do.
  2. Select the whole table.
  3. Select Macros / Beautify Table.
  4. The table should now be pretty :)
I hope you find this macro as useful as I do and enjoy using it.

PS: For better usability I recommend to make a shortcut for the macro (ex. CTRL-TAB).