Simple html tag question
Donna Middleton last edited by
I use NPP to do basic html for ads and since I do a lot of unordered lists, I was wondering if there was a way to highlight my list and insert all of the <li></li> tags. It seems like it should be simple, but I haven’t been successful. Any other time saving tips or shortcuts would be appreciated. Thank you!!
Terry R last edited by Terry R
highlight my list and insert all of the <li></li> tags
It should be, however we’d need to see an example of some of the coding. Please give enough examples with before and after results so we can see how it might work. To make sure the interpreter (where you type the post) doesn’t edit the example use the “`” character 3 times on a line before and after all the examples. This will put the examples in a black window. About 10-20 example lines should be sufficient. This character is on the same key as the ~ character (on english keyboard).
NPP uses regular expressions (regex), essentially filters to look for text (characters) which fit. As long as that was possible then a regex should be able to insert the tags in the right spots.
Terry R last edited by
I’ve taken the liberty of providing an example of how it might work, of course having your examples will help immensely.
In the first block below we see how the lines might look before the html tags are applied. Note I have presumed you already have the
</ul>code already in place as you ONLY mentioned the
</li>tags. The second block shows the result with my regex applied.
First you would highlight JUST the lines containing the list items. Very important not to select any additional lines. After this you would use the “Replace” function (Search, Replace). Now as this is a regex we need to select “regular expression” as the search mode. The expression we use is:
in the Find What window:
in the Replace window:
<li>\1</li>note 2 spaces before as our original text is left justified and we want to indent it 2 positions.
Before we click on “Replace All” confirm the selection is still in place and then tick the box named “In Selection”. If this box not selectable it means the selection has been lost. Click on “Replace all” button. Confirm your items are now correctly tagged.
<ul style="list-style-type:circle;"> Coffee Tea Milk </ul>
and after using the regex we have
<ul style="list-style-type:circle;"> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul>
Hope this helps, but as I say it is best if you can provide some examples. If the data is sensitive, please do replace with dummy data but the original formatting of your real data needs to remain (tabs, spaces etc) as this can help or hinder the final solution.