In order to easily modify in vertical selection a huge number of cells in the table in one Selection with a vertical paste. (the paste on each line is from a list which has different value on each line).
I would like to do it inside Notepad++ only without the need to program anything.
What I have from the start is normal <Tbody> content of a table like this :
<tbody>
<tr>
<td>
MachineType
</td>
<td>
Yt_GP_MachineType
</td>
<td/>
<td>
MyMachine.MachineType
</td>
</tr>
<tr>
<td>
Variant
</td>
<td>
Yt_GP_Variant
</td>
<td>
</td>
<td>
MyMachine.Variant
</td>
</tr>
<tr>
<td>
Emulation
</td>
<td>
Yt_GP_Emulation
</td>
<td>
</td>
<td>
MyMachine.Emulation
</td>
</tr>
And I would like to have a macro that linearize and align all <tr> nodes and below in a single line like this :
<tbody>
<tr><td> MachineType </td><td> Yt_GP_MachineType </td><td></td><td> MyMachine.MachineType </td></tr>
<tr><td> Variant </td><td> Yt_GP_Variant </td><td></td><td> MyMachine.Variant </td></tr>
<tr><td> Emulation </td><td> Yt_GP_Emulation </td><td></td><td> MyMachine.Emulation </td></tr>
Note: the auto alignment of each <td> & </td> nodes is important and the "Code alignment" plugin of Notepad++ doesn't work if I mentioned align by... (CTRL+SHIFT+=) "<" for my part. Currently I'm doing this manually...
Note 2 : Linearize or Pretty print from XML Tool plug in doesn't solve my issue.
The short story - IMHO you should write a script in your favorite scripting language.
BTW - spaces within <tr>...</tr>
only makes manual editing easier and should be replaced by the use of CSS e.g. <tbody style="vertical-align:center;text-align:center"><tr style="height:100px">
But if you really want to do a special linearize with Notepad++, here is the man's way on Windows. For other operating systems you have to adapt this.
<td/>
. Find what: <td/>
, Replace with: <td></td>
<tr>
, Replace with: \r\n<tr>
tr
to td
): Find what: <td>
, Replace with: \r\n<td>
</td>
(It may be necessary for you to install the plugin.)<td>
, Replace with: <td>
. Please note the two space here!<tr>
, Replace with: \r\n<tr>
All this is resulting in: