[Pkg] The Trunk: HelpSystem-Core-kfr.76.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jun 4 08:00:19 UTC 2015

Marcel Taeumel uploaded a new version of HelpSystem-Core to project The Trunk:

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

Name: HelpSystem-Core-kfr.76
Author: kfr
Time: 13 May 2015, 6:53:53.29 pm
UUID: fbad033b-7c29-0748-bdb5-02a02dff4cf7
Ancestors: HelpSystem-Core-kfr.75

Added a check/ bail out for non editable help topics

=============== Diff against HelpSystem-Core-kfr.75 ===============

Item was changed:
  ----- Method: HelpBrowser>>accept: (in category 'actions') -----
  accept: text
  	"Accept edited text. Compile it into a HelpTopic"
  	| code topicClass topicMethod updatedTopic |
  	"true ifTrue:[^self inform: 'Not implemented yet.', String cr, 'Make new help pages in the browser for the time being']."
  	(self find: (self currentTopic contents copyFrom: 1 to: 20)) asArray 
+ 		ifNotEmpty: [:refs | 
- 		ifNotEmpty: [:refs |
  		topicClass := refs first actualClass theNonMetaClass. 
  		topicMethod := refs first selector].
+ 		topicClass = nil ifTrue:[^self inform: 'This help topic can not be edited here'].
  	code := String streamContents:[:s|
  		s nextPutAll: topicMethod.
  		s crtab; nextPutAll: '"This method was automatically generated. Edit it using:"'.
  		s crtab; nextPutAll: '"', self name,' edit: ', topicMethod storeString,'"'.
  		s crtab; nextPutAll: '^HelpTopic'.
  		s crtab: 2; nextPutAll: 'title: ', currentTopic title storeString.
  		s crtab: 2; nextPutAll: 'contents: '.
  		s cr; nextPutAll: (String streamContents:[:c| c nextChunkPutWithStyle: text]) storeString.
  		s nextPutAll:' readStream nextChunkText'.
  	updatedTopic := topicClass class
  		compile: code
  		classified: ((topicClass class organization categoryOfElement: topicMethod) ifNil:['pages']).
  	self flag: #fixme. "mt: Update will not work because the topic builder eagerly cached all the contents and lost track of its origins. We need to get rid of the topic builders and create topic contents lazily resp. live."
  	self currentTopic: updatedTopic.
  	self changed: #toplevelTopics..
  	self changed: #currentTopic.
  	self changed: #topicContents.

More information about the Packages mailing list