How to make a custom @Thing cooperate with @TitleOf in a book?

Mark Summerfield <[email protected]>
Newsgroups gmane.comp.type-setting.lout
Organization Qtrac Ltd.
Message-ID <20101203160045.0e41b07a@dino>
Hi,

I have these two definitions:

def @XRef right tag{{tag}@CrossLink{
    {@TitleOf{tag}}@Case {
        ""   @Yield {(page @PageOf{tag})}
        "??"   @Yield {(page @PageOf{tag})}
        else @Yield {``@TitleOf{tag}'' (page @PageOf{tag})}
    }
}}

def @Function
    named tag {""}
    named return {""}
    named name {}
    named args {""}
{ # TODO format it nicely
+1p @Font @C{
    return @Case{"" @Yield{@Null} else @Yield{return~}} &0c
    @B{name}(args)
}
{tag @Case{"" @Yield{@Null} else @Yield @PageMark{tag}}}
}

The @Function is used like this:

@LD @Function tag{findObject.function}
    return{Object}name{findObject}
    args{objectName}

Now I want to be able to write:

    See @XRef{findObject.function}.

And have it come out as:

    See ``findObject'' (page 99).

But I don't know how to do this.

Also, I would like be to be able to make @XRef smart enough to format
functions specially by matching the end of the tag (i.e.,
".function")---is that possible?

Thanks!

-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Advanced Qt Programming" - ISBN 0321635906
            http://www.qtrac.eu/aqpbook.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.