I have to set a list of title/authors item inside an html page, with each title/author line inside a <li>
like this:
<ul> <li> title name - <em>author name</em></li> <li> title name - <em>author name</em></li> <li> title name - <em>author name</em></li> and so on... </ul>
They gave me an Excel file with two columns, one for title and one for authors, with about 90-100 rows.
What is the best and quickest way to obtain a list with <li>
s like those stated above? (I use Sublime Text 2)
Simply copy/pasting inside Sublime Text 2, i have a separate line for each title/author row, like this
title name author name title name author name title name author name
nothing else..
I can easely wrap every single line inside an <li>
thx to:
<em>
s for the authors. |
as the cursor): *copy* authors name as single lines |author name1 |author name2 |author name3 |author name4 *paste* authors as single line each where the cursor "|" stands <li>title name - <em> |author name1 </em></li> <li>title name - <em> |author name2 </em></li> <li>title name - <em> |author name3 </em></li> <li>title name - <em> |author name4 </em></li>
Unfortunately what actually happens (in sublime text 2) is this:
<li>title name - <em> |author name1 author name2 author name3 author name4 </em></li> <li>title name - <em> |author name1 author name2 author name3 author name4 </em></li> <li>title name - <em> |author name1 author name2 author name3 author name4 </em></li> <li>title name - <em> |author name1 author name2 author name3 author name4 </em></li>
all the copied lines simply get pasted in block for every single cursor
You can duplicate selected text blocks with Ctrl+Shift+D several times. Select some text and press Ctrl+D several times to select more occurrences of the selected text. This spawns a cursor on each selected text which can be moved via cursor keys.
Split Line Sublime Plugin Using ctrl+shift+\ ( ctrl+shift+` for OSX) or the context menu option split a single-line array into multiple lines.
To do that -> simply press ctrl + c with the cursor anywhere on the line you wish to copy(no text-selection please) and hit ctrl + v with the cursor anywhere on the target line. The copied line will get pasted right above your target line.
Probably you only have to verify that the number of lines copied to the clipboard matches the number of lines splitted with CMD+SHIFT+L.
If they match, Sublime Text behaves as you expected, copying each source line to each destination line (at least on my machine... :).
I actually just found the answer to this, and wanted to share just in case anyone else encounters this. Riccardo is right but I can expand.
Sublime will paste in chunks when you expect to paste in place when there is not a match between the number of sources and targets. I've encountered your bug when there's an extra hard return or extra element. So for example.
|author name1 |author name2
Will trigger Sublime to paste the two values into place because there are two source values and one target element.
<li>title name - <em> |author name1 author name2 </em></li>
So to Riccard's point, you likely might have had selected a little extra that Sublime recognized as a extra value.
So to fix this, you'll need to have equal sources and targets.
|author name1 |author name2 <li>title name - <em> |author name1 </em></li> <li>title name - <em> |author name2 </em></li>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With