OT: Strange output of shell"man xyz" on OS X
Wouter
wouter.abraham at scarlet.be
Wed May 31 08:22:29 EDT 2006
On 31 May 2006, at 12:52, Klaus Major wrote:
> Hi Alex,
>
>> Klaus Major wrote:
>>> Hi Bill,
>>>> Underscore. The boxes are backspace characters.
>>>
>>> Aha, thanks :-)
>>> Any hints on how to clean up this to display this nicely in a Rev
>>> field?
>> You do it based on the backspaces (numtochar(8))s.
>>
>> Depends how nicely you need it.
>
> VERY nice :-)
-snip-
Hi,
from an old project for what it is worth (will display the manpage as
in the terminal):
(beware of the mail wraps!!!)
set the htmltext of fld <somename> to prepMan(<raw manpage>)
local lC
function prepMan pMan
if the keys of lC = "" then preplC
put numtochar(8) into tx
set the casesensitive to true
put "" into tChars
put "<p>" into tList
repeat for each char i in pMan
if i = cr then put numtochar(13) into i
if i = space then put numtochar(14) into i
if tChars[1] = "" then -- may not be tx
if i = tx then next repeat
else
put i into tChars[1]
end if
else
if tChars[2] = "" then -- must be tx
if i = tx then put i into tChars[2]
else
put chartonum(tChars[1]) into a
put lC[a] after tList
put i into tChars[1]
end if
else
if tChars[3] = "" then -- may not be tx
if i <> tx then put i into tChars[3]
else
put chartonum(tChars[1]) into a
put lC[a] after tList
put "" into tChars
end if
else
if tChars[4] = "" then -- must be tx for sequence
if i = tx then put i into tChars[4]
else
if tChars[1] = tChars[3] then put "<b>"&lC[chartonum
(tChars[3])]&"</b>" after tList
else if tChars[1] = "_" then put "<u>"&lC[chartonum
(tChars[3])]&"</u>" after tList
else if tChars[1] = "+" and tChars[3] = "o" then put
"<u>"&lC[chartonum(tChars[3])]&"</u>" after tList
else put lC[chartonum(tChars[3])] after tList
put "" into tChars
put i into tChars[1]
end if
else
if tChars[3] = i then put "<b>"&lC[chartonum(i)]&"</b>"
into tTemp
if tChars[1] = "_" then put "<u>" & tTemp & "</u>" into
tTemp
put tTemp after tList
put "" into tChars
end if
end if
end if
end if
end repeat
return tList & "</p>"
end prepMan
on preplC
repeat with i = 33 to 255
put numtochar(i) into fld "temp" ### hidden field
put char 4 to -5 of the htmltext of fld "temp" into lC[i]
end repeat
put "</p>" & cr & "<p>" into lC["13"] -- cr > more readable in
the debugger
put space into lC["14"]
end preplC
Greetings,
Wouter
More information about the use-livecode
mailing list