[squeak-dev] The Trunk: HelpSystem-Core-mt.91.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Aug 14 08:44:26 UTC 2016
Marcel Taeumel uploaded a new version of HelpSystem-Core to project The Trunk:
http://source.squeak.org/trunk/HelpSystem-Core-mt.91.mcz
==================== Summary ====================
Name: HelpSystem-Core-mt.91
Author: mt
Time: 14 August 2016, 10:44:22.759642 am
UUID: b87f5b33-61b1-ea48-8031-118523b083f9
Ancestors: HelpSystem-Core-mt.90
Make help text editing more robust.
=============== Diff against HelpSystem-Core-mt.90 ===============
Item was changed:
----- Method: HelpBrowser>>accept: (in category 'actions') -----
accept: text
"Accept edited text. Compile it into a HelpTopic"
+ | code parent topicClass topicMethod topicMethodSelector normalizedText colorsToRemove |
- | code parent topicClass topicMethod normalizedText colorsToRemove |
(self currentParentTopic isNil or: [self currentParentTopic isEditable not])
ifTrue: [^ self inform: 'This help topic cannot be edited.'].
self changed: #clearUserEdits.
parent := self currentParentTopic.
topicClass := parent helpClass.
topicMethod := self currentTopic key.
+ topicMethodSelector := topicMethod copyReplaceAll: '-' with: ''.
normalizedText := text.
"Remove default colors for the sake of UI themes."
colorsToRemove := {Color black. Color white}.
normalizedText runs: (normalizedText runs collect: [:attributes | attributes reject: [:attribute |
(((attribute respondsTo: #color) and: [colorsToRemove includes: attribute color])
or: [attribute respondsTo: #font])]]).
code := String streamContents:[:s|
+ s nextPutAll: topicMethodSelector.
- s nextPutAll: topicMethod.
s crtab; nextPutAll: '"This method was automatically generated. Edit it using:"'.
+ s crtab; nextPutAll: '"', topicClass name,' edit: ', topicMethod storeString,'"'.
+ s crtab; nextPutAll: '^(HelpTopic'.
- 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: normalizedText]) storeString.
+ s nextPutAll:' readStream nextChunkText)'.
+ s crtab: 3; nextPutAll: 'key: ', topicMethod storeString.
- s nextPutAll:' readStream nextChunkText'.
].
topicClass class
compile: code
+ classified: ((topicClass class organization categoryOfElement: topicMethodSelector) ifNil:['pages']).
- classified: ((topicClass class organization categoryOfElement: topicMethod) ifNil:['pages']).
parent refresh.
parent == self rootTopic ifTrue: [self rootTopic: parent].
self currentTopic: (parent subtopics detect: [:t | t key = topicMethod]).!
Item was changed:
----- Method: HelpBrowser>>currentParentTopic: (in category 'accessing') -----
currentParentTopic: aHelpTopic
+ currentParentTopic := aHelpTopic ifNil: [self rootTopic].!
- currentParentTopic := aHelpTopic.!
More information about the Squeak-dev
mailing list
|