A community of Frontier
and Radio Users


Meridian News


Community List


Regex Project

I'm importing quite a few pages into my root these days, along with their corresponding graphics. Unfortunately, the import command leaves one thing to be desired: it doesn't change <img src> commands to \{imageref()} macros. So I modified an existing menu command in the system.verbs.builtin.html.menu table to do this for me (in a quick and dirty way).

After selecting the graphic's name (e.g., "picture" is the name in "picture.jpg") I select "Convert Graphic" from my HTML menu. The following script copies the selection and creates an {imageref()} macro, including a "left" tag. This particular version places the information at the top of the document, which is where the current batch of images appear. You'll need to modify the placement to suit your needs. If anyone knows of a complete parser for graphics let us all know.

on addGraphic ()
    local (start, end, x)
    wp.setTextMode (true)
    wp.getSelect (@start, @end)
    if start == end // Nothing selected
        wp.setselect(0,0)
        wp.insert ("\{imageref(""+source+"",attrib:"align=left")}")
    else
        local (source, html)
        source = wp.getSelText ()
        wp.setselect(0,0)
        wp.insert ("\{imageref(""+source+"",attrib:"align=left")}")
        window.update (window.frontmost ())
 return (true)


Editor's Note:: Jeb Bateman's "Enhanced imageRef Macro" contains a ContentServer callback that converts image tags to imageRef macros.