--- a/HTMLDocGenerator.st Wed Mar 26 18:34:26 1997 +0100
+++ b/HTMLDocGenerator.st Fri Apr 04 10:51:11 1997 +0200
@@ -1152,154 +1152,6 @@
"Modified: 9.11.1996 / 00:34:38 / cg"
!
-manPageFor:aCommand
- "q&d hack to convert man output to html"
-
- ^ self
- manPageFor:aCommand
- inSection:nil
-
- "Modified: 9.9.1996 / 17:45:29 / cg"
-!
-
-manPageFor:aCommand inSection:sectionOrNil
- "q&d hack to convert man output to html"
-
- |manCmd|
-
- sectionOrNil isNil ifTrue:[
- manCmd := 'man ' , aCommand
- ] ifFalse:[
- manCmd := 'man ' , sectionOrNil printString , ' ' , aCommand
- ].
- ^ self
- manPageFor:aCommand
- manCommand:manCmd.
-
- "Created: 9.9.1996 / 17:45:08 / cg"
- "Modified: 9.9.1996 / 17:48:29 / cg"
-!
-
-manPageFor:aCommand manCommand:manCommand
- "q&d hack to convert man output to html"
-
- |s t outStream state ch keep|
-
- s := PipeStream readingFrom:manCommand.
- s notNil ifTrue:[
- outStream := '' writeStream.
- state := nil.
- keep := nil.
- [s atEnd] whileFalse:[
- ch := s next.
-
- ch notNil ifTrue:[
- state == nil ifTrue:[
- ch == Character backspace ifTrue:[
- state := #back
- ] ifFalse:[
- keep notNil ifTrue:[
- keep == $< ifTrue:[
- outStream nextPutAll:'<'.
- ] ifFalse:[
- outStream nextPut:keep.
- ].
- ].
- keep := ch
- ]
- ] ifFalse:[
- state == #back ifTrue:[
- ch == keep ifTrue:[
- outStream nextPutAll:'<b>'.
- ch == $< ifTrue:[
- outStream nextPutAll:'<'.
- ] ifFalse:[
- outStream nextPut:ch.
- ].
- outStream nextPutAll:'</b>'.
- state := nil.
- keep := nil.
- ] ifFalse:[
- ch == $_ ifTrue:[
- keep notNil ifTrue:[
- outStream nextPutAll:'<i>'.
- keep == $< ifTrue:[
- outStream nextPutAll:'<'.
- ] ifFalse:[
- outStream nextPut:keep.
- ].
- outStream nextPutAll:'</i>'.
- ].
- state := nil.
- keep := nil.
- ] ifFalse:[
- keep == $_ ifTrue:[
- outStream nextPutAll:'<i>'.
- ch == $< ifTrue:[
- outStream nextPutAll:'<'.
- ] ifFalse:[
- outStream nextPut:ch.
- ].
- outStream nextPutAll:'</i>'.
- state := nil.
- keep := nil.
- ] ifFalse:[
- keep notNil ifTrue:[
- keep == $< ifTrue:[
- outStream nextPutAll:'<'.
- ] ifFalse:[
- outStream nextPut:keep.
- ].
- ch == $< ifTrue:[
- outStream nextPutAll:'<'.
- ] ifFalse:[
- outStream nextPut:ch.
- ]
- ].
- state := nil.
- keep := nil.
- ]
- ]
- ]
- ]
- ]
- ]
- ].
-
- keep notNil ifTrue:[
- keep == $< ifTrue:[
- outStream nextPutAll:'<'.
- ] ifFalse:[
- outStream nextPut:keep
- ]
- ].
- t := outStream contents.
- s shutDown.
- ].
-
- (t isNil or:[t isEmpty]) ifTrue:[
- ^ '
-No manual page for "<CODE><B>' , aCommand , '</B></CODE>" available.
-<BR>
-(the failed command was: "<CODE>' , manCommand , '"</CODE>.)
-'.
- ].
-
- ^ '
-<pre>
-' , t , '
-</pre>
-'
-
- "
- self manPageFor:'cvs'
- "
-
- "Modified: 28.6.1996 / 21:28:47 / stefan"
- "Created: 9.9.1996 / 17:43:16 / cg"
- "Modified: 9.9.1996 / 17:58:00 / cg"
-!
-
printOutHTMLCategoryProtocol:aCategory of:aClass on:aStream
|any dict selectors methods shortName|
@@ -1534,6 +1386,174 @@
"Modified: 30.12.1996 / 19:06:50 / cg"
! !
+!HTMLDocGenerator class methodsFor:'format conversion - man pages'!
+
+manPageFor:aCommand
+ "generate a man page & convert the output to html"
+
+ ^ self
+ manPageFor:aCommand
+ inSection:nil
+
+ "Modified: 4.4.1997 / 10:50:41 / cg"
+!
+
+manPageFor:aCommand inSection:sectionOrNil
+ "generate a man page for some entry in a section
+ & convert the output to html"
+
+ |manCmd|
+
+ sectionOrNil isNil ifTrue:[
+ manCmd := 'man ' , aCommand
+ ] ifFalse:[
+ manCmd := 'man ' , sectionOrNil printString , ' ' , aCommand
+ ].
+ ^ self
+ manPageFor:aCommand
+ manCommand:manCmd.
+
+ "Created: 9.9.1996 / 17:45:08 / cg"
+ "Modified: 4.4.1997 / 10:50:55 / cg"
+!
+
+manPageFor:aCommand manCommand:manCommand
+ "convert man-command output to html"
+
+ |s t outStream state ch keep|
+
+ s := PipeStream readingFrom:manCommand.
+ s notNil ifTrue:[
+ outStream := '' writeStream.
+ state := nil.
+ keep := nil.
+ [s atEnd] whileFalse:[
+ ch := s next.
+
+ ch notNil ifTrue:[
+ state == nil ifTrue:[
+ ch == Character backspace ifTrue:[
+ state := #back
+ ] ifFalse:[
+ keep notNil ifTrue:[
+ keep == $< ifTrue:[
+ outStream nextPutAll:'<'.
+ ] ifFalse:[
+ outStream nextPut:keep.
+ ].
+ ].
+ keep := ch
+ ]
+ ] ifFalse:[
+ state == #back ifTrue:[
+ ch == keep ifTrue:[
+ outStream nextPutAll:'<b>'.
+ ch == $< ifTrue:[
+ outStream nextPutAll:'<'.
+ ] ifFalse:[
+ outStream nextPut:ch.
+ ].
+ outStream nextPutAll:'</b>'.
+ state := nil.
+ keep := nil.
+ ] ifFalse:[
+ ch == $_ ifTrue:[
+ keep notNil ifTrue:[
+ outStream nextPutAll:'<i>'.
+ keep == $< ifTrue:[
+ outStream nextPutAll:'<'.
+ ] ifFalse:[
+ outStream nextPut:keep.
+ ].
+ outStream nextPutAll:'</i>'.
+ ].
+ state := nil.
+ keep := nil.
+ ] ifFalse:[
+ keep == $_ ifTrue:[
+ outStream nextPutAll:'<i>'.
+ ch == $< ifTrue:[
+ outStream nextPutAll:'<'.
+ ] ifFalse:[
+ outStream nextPut:ch.
+ ].
+ outStream nextPutAll:'</i>'.
+ state := nil.
+ keep := nil.
+ ] ifFalse:[
+ keep notNil ifTrue:[
+ keep == $< ifTrue:[
+ outStream nextPutAll:'<'.
+ ] ifFalse:[
+ outStream nextPut:keep.
+ ].
+ ch == $< ifTrue:[
+ outStream nextPutAll:'<'.
+ ] ifFalse:[
+ outStream nextPut:ch.
+ ]
+ ].
+ state := nil.
+ keep := nil.
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
+
+ keep notNil ifTrue:[
+ keep == $< ifTrue:[
+ outStream nextPutAll:'<'.
+ ] ifFalse:[
+ outStream nextPut:keep
+ ]
+ ].
+ t := outStream contents.
+ s shutDown.
+ ].
+
+ (t isNil or:[t isEmpty]) ifTrue:[
+ ^ '
+No manual page for "<CODE><B>' , aCommand , '</B></CODE>" available.
+<BR>
+(the failed command was: "<CODE>' , manCommand , '"</CODE>.)
+'.
+ ].
+
+ ^ '
+<pre>
+' , t , '
+</pre>
+'
+
+ "
+ self manPageFor:'cvs'
+ "
+
+ "Modified: 28.6.1996 / 21:28:47 / stefan"
+ "Created: 9.9.1996 / 17:43:16 / cg"
+ "Modified: 4.4.1997 / 10:50:01 / cg"
+!
+
+manPageForFile:aFilename
+ "convert a .man file to html"
+
+ ^ self
+ manPageFor:aFilename asFilename name
+ manCommand:('nroff -man ' , aFilename asFilename pathName).
+
+ "
+ self manPageForFile:'../../stc/stc.1'
+ "
+ "
+ HTMLDocumentView openFullOnText:(self manPageForFile:'../../stc/stc.1')
+ "
+
+ "Modified: 4.4.1997 / 10:44:05 / cg"
+! !
+
!HTMLDocGenerator class methodsFor:'helpers'!
extractSpecial:pattern from:docu
@@ -1573,5 +1593,5 @@
!HTMLDocGenerator class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/HTMLDocGenerator.st,v 1.17 1997-03-22 15:20:04 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/HTMLDocGenerator.st,v 1.18 1997-04-04 08:51:11 cg Exp $'
! !