aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJohn Fieber <jfieber@FreeBSD.org>1997-01-08 01:40:52 +0000
committerJohn Fieber <jfieber@FreeBSD.org>1997-01-08 01:40:52 +0000
commit945a70117384b16f78630e5c6ae2b078d7f352a6 (patch)
tree29d3bd1b9ac0ccb5edeb735b4405677e68e66115 /usr.bin
parent22d0d81b7137b488d434189a07cc3516fe17edc7 (diff)
downloadsrc-945a70117384b16f78630e5c6ae2b078d7f352a6.tar.gz
src-945a70117384b16f78630e5c6ae2b078d7f352a6.zip
Add an "else" clause to _followrel.
This should be in 2.2.
Notes
Notes: svn path=/head/; revision=21412
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/sgmls/instant/transpec.58
-rw-r--r--usr.bin/sgmls/instant/tranvar.c12
2 files changed, 14 insertions, 6 deletions
diff --git a/usr.bin/sgmls/instant/transpec.5 b/usr.bin/sgmls/instant/transpec.5
index 3226bbf20aa7..297b9d064399 100644
--- a/usr.bin/sgmls/instant/transpec.5
+++ b/usr.bin/sgmls/instant/transpec.5
@@ -311,7 +311,7 @@ l l.
\fB_filename\fP@filename of notation
\fB_find\fP \fIrel\fP \fIgi\fP \fIspec-id\fP@find gi based on relationship
\fB_followlink\fP [\fIattname\fP] \fIspec-id\fP@follow IDREFs [attname] and use spec-id
-\fB_followrel\fP \fIrel\fP \fIgi\fP \fIspec-id\fP@do spec-id on rel if it matches
+\fB_followrel\fP \fIrel\fP \fIgi\fP \fIspec-id\fP [\fIspec-id\fP]@do spec-id on rel if it matches
\fB_gi\fP [\fBM|L|U\fP]@return GI name; M, L, U case
\fB_id\fP \fIid [\fP\fIspec-id\fP]@find element with ID and use spec-id
\fB_include\fP \fIfilename\fP@insert file here
@@ -383,9 +383,11 @@ It will then apply the transpec specified by \fIspec-id\fP to that element.
If specified, it will follow the link pointed to by \fIattname\fP.
By default, \fBinstant\fP assumes the attributes named \fBLINKEND\fP and \fBLINKENDS\fP are if type IDREF or IDREFS.
You can change this by setting the variable \fBlink_atts\fP to a space-separated list of attribute names.
-.IP "\fB_followrel\fP \fIrelationship\fP \fIgi\fP \fIspec-id\fP"
+.IP "\fB_followrel\fP \fIrelationship\fP \fIgi\fP \fIspec-id\fP [\fIspec-id2\fP]"
If the \fIgi\fP has the specified \fIrelationship\fP to the current element,
-perform the action specified by \fIspec-id\fP on the related element.
+perform the action specified by \fIspec-id\fP on the related element.
+If the \fIrelationship\fP to \fIgi\fP does not exist,
+and \fIspec-id2\fP is present, perform \fIspec-id2\fP on the current element.
See the discussion of the criteria field \fBRelation\fP for acceptable relationship names.
.IP "\fB_gi\fP [\fBM|L|U\fP]"
Print the name of the current GI to the output stream.
diff --git a/usr.bin/sgmls/instant/tranvar.c b/usr.bin/sgmls/instant/tranvar.c
index c8778a82f9f2..ab04425d1284 100644
--- a/usr.bin/sgmls/instant/tranvar.c
+++ b/usr.bin/sgmls/instant/tranvar.c
@@ -373,10 +373,16 @@ ExpandSpecialVar(
}
/* Do action on followed element if element has [relationship] with gi.
- * Format: _followrel relationship gi action */
+ * If [relationship] is not met, do alternate action on this element.
+ * Format: _followrel relationship gi action [action] */
else if (StrEq(tok[0], "followrel")) {
- if (ntok >= 4)
- (void)CheckRelation(e, tok[1], tok[2], tok[3], fp, RA_Related);
+ if (ntok >= 4) {
+ if (!CheckRelation(e, tok[1], tok[2], tok[3], fp, RA_Related)) {
+ /* action not done, see if an alt action specified */
+ if (ntok >= 5)
+ TranTByAction(e, tok[4], fp);
+ }
+ }
}
/* Find element with matching ID and do action. If action not specified,