blob: aaa3fab0063f20bbc7e931431ff412501e6bbed0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
\begin{page}{HTXLinkPage5}{Linking to Unix}
\centerline{\fbox{{\tt \thispage}}}\newline
\begin{scroll}
Let us conclude the tour of \HyperName{}
actions that can be triggered with a click of a button
with two more facilities. These are
\beginImportant
\table{
{ {\tt \\unixcommand\{{\it trigger text}\}\{{\it unix command}\}}}
{ {\tt \\unixlink\{{\it trigger text}\}\{{\it unix command}\}}}
}
\endImportant
The first one, {\tt \\unixcommand}, is very much like
{\tt \\axiomcommand} and {\tt \\lispcommand}.
The trigger text becomes an active area. Clicking on it
will force \HyperName{} to pass the second argument
to the system as a shell command to be executed.
The shell used is {\bf /bin/sh}.
\HyperName{} ignores the output of the command.
\beginImportant
\begin{paste}{HTXLinkPage5xPaste1}{HTXLinkPage5xPatch1}
\pastebutton{HTXLinkPage5xPaste1}{Interpret}
\newline
{\tt \\unixcommand\{List \\\$HOME directory\}\{ls \\\$HOME\}}\newline
\end{paste}
\endImportant
The {\tt \\unixlink} command delegates to a another
program the creation of a dynamic page. When the trigger
text is activated, \HyperName{} will invoke the command
specified in the second argument. It will then start reading
the {\it standard output} of the command until
a complete page has been received. It is important that
a single page and nothing more is written by the command.
This command is essentially a {\tt \\downlink}, i.e.
the new page replaces the current page in the window.
There aren't any other flavours of {\tt \\unixlink}.
A trivial example is to use {\bf cat} on a \HyperName{}
file known to contain just one page.
\beginImportant
\begin{paste}{HTXLinkPage5xPaste2}{HTXLinkPage5xPatch2}
\pastebutton{HTXLinkPage5xPaste2}{Interpret}
\newline
{\tt \\unixlink\{Some file\}} \newline
{\tt \{cat\\ \\env\{AXIOM\}/doc/hypertex/pages/HTXplay.ht\}}
\end{paste}
\endImportant
Two things to notice in the second argument of
{\tt \\unixlink}: You must use a {\it hard space}
{\tt '\\\ '} to preserve the spacing in the command.
Also, the {\tt \\env} command allows you to use
an environment variable in \HyperName{} text.
With a little ingenuity (and maybe some shell and {\bf awk} scripts !)
, one can use these
facilities to create, say, a point-and-click
directory viewer which allows you to edit
a file by clicking on its name.
\end{scroll}
\beginmenu
\menulink{Next -- How to use your pages with \HyperName{}}{HTXLinkPage6}
\endmenu
\end{page}
\begin{patch}{HTXLinkPage5xPatch1}
\begin{paste}{HTXLinkPage5xPaste1A}{HTXLinkPage5xPatch1A}
\pastebutton{HTXLinkPage5xPaste1A}{Source}
\newline
\unixcommand{List \$HOME directory}{ls \$HOME}
\end{paste}
\end{patch}
\begin{patch}{HTXLinkPage5xPatch1A}
\begin{paste}{HTXLinkPage5xPaste1B}{HTXLinkPage5xPatch1}
\pastebutton{HTXLinkPage5xPaste1B}{Interpret}
\newline
{\tt \\unixcommand\{List \\\$HOME directory\}\{ls \\\$HOME\}}\newline
\end{paste}
\end{patch}
\begin{patch}{HTXLinkPage5xPatch2}
\begin{paste}{HTXLinkPage5xPaste2A}{HTXLinkPage5xPatch2A}
\pastebutton{HTXLinkPage5xPaste2A}{Source}
\newline
\unixlink{Some file}
{cat\ \env{AXIOM}/doc/hypertex/pages/HTXplay.ht}
\end{paste}
\end{patch}
\begin{patch}{HTXLinkPage5xPatch2A}
\begin{paste}{HTXLinkPage5xPaste2B}{HTXLinkPage5xPatch2}
\pastebutton{HTXLinkPage5xPaste2B}{Interpret}
\newline
{\tt \\unixlink\{Some file\}} \newline
{\tt \{cat\\ \\env\{AXIOM\}/doc/hypertex/pages/HTXplay.ht\}}
\end{paste}
\end{patch}
|