%H codes can also execute
Metamorph queries on the string parameter and markup the resulting
m flag indicates that Metamorph hit markup should
occur; the Metamorph query string (
char *) is then taken to be
the next parameter (before the normal string parameter to be searched
and printed). The
m flag and its sub-flags are only valid for
%H codes, and must follow any standard
m flag can be any of the following sub-flags.
These must immediately follow the
m flag, as some letters
have other meanings elsewhere:
bfor bold highlighting of hits
hfor HREF highlighting (default)
nindicates that hits that overlap tags should not be truncated/moved
pfor paragraph formatting: replace
cto continue hit count into next
The Metamorph query is opened with a default
or the one supplied by
htpf_setapicp() if it was called
earlier. Each hit found by the query has each of its sets' hits (not
the overall hit) highlighted in the output.
h flag sets HREF highlighting (the default). Each hit
becomes an HREF that links to the next hit in the output, with the
last hit pointing back to the first. In the output, the anchors for
the hits are named
hitN, where N is the hit number
(starting with 1).
Hits can be bold highlighted in the output with the
this surrounds them with
h can be combined; the default if neither is given is HREF
Normally, hits that are inside or overlap
<> tags are
truncated or moved to appear outside the tag in the output, so that
the highlighting tags don't overlap them and muddle the HTML output.
n tag indicates that this truncation should not be done.
(It is also not done for
%H, since the tags in the string are
p flag does paragraph formatting: double newlines in the
string are replaced by
"\n<P>\n\n" in the output.
c flag indicates that the hit count should be continued
for the next query. By default, the last hit in a
%H string is linked back to the first hit.
%-code query markup is self-contained: if
multiple calls are made, the hit count (and resulting HREFs) will
start over for each call, which may not be desired. If the
flag is given, the last hit in the string is linked to the "next"
hit (N+1) instead of the first, and the next
will start numbering hits at N+1 instead of 1. Thus, all but the
%H query printed by a program should
char *Query = "/yin /yang";
char *Buffer1 = "This is a test.\nIs yin <\nyang?";
char *Buffer2 = "Or is yang <\nyin?\nI can't know.";
htpf("Results of query on %t:<HR>\n", time(NULL));
htpf("%mcH\n", Query, Buffer1); /* the 'c' continues hit count */
htpf("%mH\n", Query, Buffer2);
Results of query on Sat Oct 4 12:51:15 EST 1997:<HR>
This is a test.
Is <A NAME=hit1 HREF=#hit2>yin</A> <
<A NAME=hit2 HREF=#hit3>yang</A>?
Or is <A NAME=hit3 HREF=#hit4>yang</A> <
<A NAME=hit4 HREF=#hit1>yin</A>?
I can't know.
c flag to
m queries makes the last HREF link to
the next hit anchor, which doesn't exist yet; therefore it assumes the
next query will have at least one hit, or else the link will point to
a nonexistent anchor.