A community of Frontier
and Radio Users


Meridian News


Community List


Regex Project

In one website I maintain I need a specific kind of formatting. I've modified the HTML menu to include a "Custom" item, with several macros listed. For instance, "makeNewsHead" below wraps the selected text with glossary references (such as "newsAttnIn" and "newsAttnOut") that are expanded in the normal rendering process. This allows me to quickly select a style for a selection, without having to a) type everything or b) worry about getting the closing tags correct. This macro, by the way, is simply a modified version of the "addHTMLTag" macro.

on makeNewsHead ()
    local (start, end)
    wp.setTextMode (true)
    wp.getSelect (@start, @end)
    if start == end \// Nothing selected
        wp.insert (""newsAttnIn""+"itemHere"+""newsAttnOut"")
    else
        local (source, html)
        source = wp.getSelText ()
        html = ""newsAttnIn"" + source + ""newsAttnOut""
        wp.insert (html)
        wp.setSelect (start + 12, end + 12)
    window.update (window.frontmost ())
    return (true)