|
Add italic tags
[Back]
Here's a macro that inserts HTML italic tags.
If there is a selection, it's surrounded by <I> and </I>.
If there is no selection it inserts </I> or <I>
depending on whether there is an open start-italic tag or not. Easy to
modify for other tag pairs.
# If there is a selection put <I> before it and </I> after it.
# If there is no selection put <I> if italic mode is off, else </I>
if (-1 == $selection_start) {
# No selection -- Insert tag to toggle italic mode
on = 0
off = 0
if (-1 != search("<I>", $cursor, "backward"))
on = $search_end
if (-1 != search("</I>", $cursor, "backward"))
off = $search_end
if (on <= off)
insert-string("<I>")
else
insert-string("</I>")
}
else {
# Put selection in italics
x = get_selection()
beginning_of_selection()
insert-string("<I>")
insert-string(x)
insert-string("</I>")
}
[Back]
Released on Wed, 21 Nov 2001
by
C. Denat
|
|