[Pkg] The Trunk: HelpSystem-Core-mt.67.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Mar 25 16:20:56 UTC 2015


Marcel Taeumel uploaded a new version of HelpSystem-Core to project The Trunk:
http://source.squeak.org/trunk/HelpSystem-Core-mt.67.mcz

==================== Summary ====================

Name: HelpSystem-Core-mt.67
Author: mt
Time: 25 March 2015, 5:20:51.722 pm
UUID: 841bd9fa-4dc8-6742-bb26-285b46bd2c9d
Ancestors: HelpSystem-Core-mt.66

Support added for html websites such as Swiki.

=============== Diff against HelpSystem-Core-mt.66 ===============

Item was changed:
  AbstractHelpTopic subclass: #ClassAPIHelpTopic
  	instanceVariableNames: 'theClass withSubclasses withMethods subclassesAsSeparateTopic'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'HelpSystem-Core-Model'!
+ 
+ !ClassAPIHelpTopic commentStamp: 'mt 3/25/2015 15:03' prior: 0!
+ Show comments of a class, their subclasses and methods.!

Item was added:
+ AbstractHelpTopic subclass: #HtmlHelpTopic
+ 	instanceVariableNames: 'url cache selectBlock convertBlock subtopicUrls'
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'HelpSystem-Core-Model'!

Item was added:
+ ----- Method: HtmlHelpTopic>>contents (in category 'accessing') -----
+ contents
+ 
+ 	| start end |
+ 	start := (self document findString: '<body').
+ 	start := (self document findString: '>' startingAt: start) + 1.
+ 	end := self document findString: '</body>' startingAt: start.
+ 	
+ 	start > end ifTrue: [^ ''].
+ 	
+ 	^ (self document copyFrom: start to: end - 1) asUnHtml withBlanksTrimmed!

Item was added:
+ ----- Method: HtmlHelpTopic>>convertBlock (in category 'accessing') -----
+ convertBlock
+ 
+ 	^ convertBlock ifNil: [ [:url | url] ]!

Item was added:
+ ----- Method: HtmlHelpTopic>>convertBlock: (in category 'accessing') -----
+ convertBlock: aBlock
+ 
+ 	convertBlock := aBlock.!

Item was added:
+ ----- Method: HtmlHelpTopic>>document (in category 'accessing') -----
+ document
+ 
+ 	^ cache ifNil: [cache := (HTTPSocket httpGet: self url accept: 'text/html') contents]!

Item was added:
+ ----- Method: HtmlHelpTopic>>hasSubtopics (in category 'testing') -----
+ hasSubtopics
+ 
+ 	^ self subtopicUrls notEmpty!

Item was added:
+ ----- Method: HtmlHelpTopic>>selectBlock (in category 'accessing') -----
+ selectBlock
+ 
+ 	^ selectBlock ifNil: [ [:url | true] ]!

Item was added:
+ ----- Method: HtmlHelpTopic>>selectBlock: (in category 'accessing') -----
+ selectBlock: aBlock
+ 	"Which urls should be followed?"
+ 
+ 	selectBlock := aBlock.!

Item was added:
+ ----- Method: HtmlHelpTopic>>subtopicUrls (in category 'accessing') -----
+ subtopicUrls
+ 
+ 	^ subtopicUrls ifNil: [
+ 		| start end |
+ 		subtopicUrls := OrderedCollection new.
+ 
+ 		start := self document findString: '<a '.
+ 		start := self document findString: 'href' startingAt: start.
+ 		[start > 0] whileTrue: [
+ 			start := self document findString: '"' startingAt: start.
+ 			end := self document findString: '"' startingAt: start+1.
+ 			subtopicUrls addIfNotPresent: (self document copyFrom: start+1 to: end-1).
+ 			start := self document findString: '<a ' startingAt: end+1.
+ 			start > 0 ifTrue: [start := self document findString: 'href' startingAt: start]].
+ 
+ 		subtopicUrls := subtopicUrls
+ 			select: self selectBlock
+ 			thenCollect: self convertBlock.
+ 		subtopicUrls]!

Item was added:
+ ----- Method: HtmlHelpTopic>>subtopics (in category 'accessing') -----
+ subtopics
+ 
+ 	| start end urls |
+ 	urls := OrderedCollection new.
+ 	
+ 	start := self document findString: '<a '.
+ 	[start > 0] whileTrue: [
+ 		start := self document findString: 'href' startingAt: start.
+ 		start := (self document findString: '"' startingAt: start) + 1.
+ 		end := self document findString: '"' startingAt: start.
+ 		urls addIfNotPresent: (self document copyFrom: start to: end - 1).
+ 		start := self document findString: '<a ' startingAt: start.].
+ 	
+ 	^ (self subtopicUrls collect: [:url | self class new
+ 			url: url;
+ 			selectBlock: self selectBlock;
+ 			convertBlock: self convertBlock])
+ 		do: [:topic | topic document; subtopicUrls "download now"] displayingProgress: [:topic | 'Fetching documents ... ', topic url];
+ 		yourself!

Item was added:
+ ----- Method: HtmlHelpTopic>>title (in category 'accessing') -----
+ title
+ 
+ 	| start end |
+ 	start := (self document findString: '<title') + 6.
+ 	start := (self document findString: '>' startingAt: start) + 1.
+ 	end := self document findString: '</title>' startingAt: start.
+ 	
+ 	start > end ifTrue: [^ self url printStringLimitedTo: 10].
+ 	
+ 	^ self document copyFrom: start to: end - 1!

Item was added:
+ ----- Method: HtmlHelpTopic>>url (in category 'accessing') -----
+ url
+ 
+ 	^ url!

Item was added:
+ ----- Method: HtmlHelpTopic>>url: (in category 'accessing') -----
+ url: aString
+ 
+ 	url := aString.!

Item was changed:
  AbstractHelpTopic subclass: #PackageAPIHelpTopic
  	instanceVariableNames: 'packageName'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'HelpSystem-Core-Model'!
+ 
+ !PackageAPIHelpTopic commentStamp: 'mt 3/25/2015 15:02' prior: 0!
+ List all classes and their method comments. No subclasses.!



More information about the Packages mailing list