Marcel Taeumel uploaded a new version of HelpSystem-Core to project The Trunk:
http://source.squeak.org/trunk/HelpSystem-Core-mt.113.mcz==================== Summary ====================
Name: HelpSystem-Core-mt.113
Author: mt
Time: 13 August 2019, 2:38:04.401456 pm
UUID: 010fa2a7-f2ea-f444-a7fc-0ad425963438
Ancestors: HelpSystem-Core-mt.112
For class-based help topics, adds support to store help contents in any method in the system. Uses message sends for the indirection. First use case is the Squeak license, which is stored in "Smalltalk license" and which should be available even without the help system.
=============== Diff against HelpSystem-Core-mt.112 ===============
Item was changed:
----- Method: ClassBasedHelpTopic>>accept:for: (in category 'editing') -----
accept: newContents for: subtopic
+ "Supports indirect content storage in classes other than helpClass."
+
+ | topicClass topicMethodSelector code indirect |
+ (indirect := subtopic contentsAsIs isMessageSend)
+ ifFalse: [
+ topicClass := self helpClass.
+ topicMethodSelector := subtopic key asLegalSelector asSymbol]
+ ifTrue: [
+ topicClass := subtopic contentsAsIs receiver.
+ topicMethodSelector := subtopic contentsAsIs selector].
-
- | topicClass topicMethodSelector code |
- topicClass := self helpClass.
- topicMethodSelector := subtopic key asLegalSelector asSymbol.
code := String streamContents:[:s|
s nextPutAll: topicMethodSelector.
s crtab; nextPutAll: '"This method was automatically generated. Edit it using:"'.
+ s crtab; nextPutAll: '"', self helpClass name,' edit: ', subtopic key storeString,'"'.
+
+ indirect ifTrue: [s crtab; nextPutAll: '^ ('] ifFalse: [
+ s crtab; nextPutAll: '^(HelpTopic'.
+ s crtab: 2; nextPutAll: 'title: ', subtopic title storeString.
+ s crtab: 2; nextPutAll: 'contents: '].
+
- s crtab; nextPutAll: '"', topicClass name,' edit: ', subtopic key storeString,'"'.
- s crtab; nextPutAll: '^(HelpTopic'.
- s crtab: 2; nextPutAll: 'title: ', subtopic title storeString.
- s crtab: 2; nextPutAll: 'contents: '.
s cr; nextPutAll: (String streamContents:[:c| c nextChunkPutWithStyle: newContents]) storeString.
s nextPutAll:' readStream nextChunkText)'.
+
+ indirect ifFalse: [
+ s crtab: 3; nextPutAll: 'key: ', subtopic key storeString].
- s crtab: 3; nextPutAll: 'key: ', subtopic key storeString.
].
topicClass class
compile: code
classified: ((topicClass class organization categoryOfElement: topicMethodSelector) ifNil:['pages']).!
Item was changed:
----- Method: HelpTopic>>contents (in category 'accessing') -----
contents
+ "Returns the receivers contents. Supports indirect contents through message sends."
- "Returns the receivers contents"
+ ^ contents value!
- ^ contents!
Item was added:
+ ----- Method: HelpTopic>>contentsAsIs (in category 'accessing') -----
+ contentsAsIs
+
+ ^ contents!