Page 1 of 1

newbie question - ul ol lists

Posted: Thu Oct 09, 2008 9:01 am
by Mikko2
Total newbie question:
Is there a way in Textpad to quickly format lists?

For example if I have
one
two
three
four

and want it to look like this
<ol>
<li>one</li>
<li>two</li>
<li>three</li>
<li>four</li>
</ol>

what would be the quickest way to do it?

Posted: Thu Oct 09, 2008 10:06 am
by ben_josephs
You can create the list elements with
Find what: ^+*$
Replace with: <li>\0</li>

[X] Regular expression

Replace All
How do you know where the lists start and end? If they are always preceded and followed by a blank line, you can insert the opening list tags with
Find what: ^\n<li>
Replace with: \n<ol>\n<li>

[X] Regular expression

Replace All
and insert the closing list tags with
Find what: </li>\n$
Replace with: </li>\n</ol>\n

[X] Regular expression

Replace All
You might record a macro to do all this.