Christoph Thiede uploaded a new version of HelpSystem-Core to project The Trunk: http://source.squeak.org/trunk/HelpSystem-Core-ct.144.mcz
==================== Summary ====================
Name: HelpSystem-Core-ct.144 Author: ct Time: 18 August 2023, 10:33:20.809279 pm UUID: acd95395-96d3-9e49-9078-0308239e9026 Ancestors: HelpSystem-Core-ct.143
Documents new extension points from previous version in SearchTopic. Adds multilingual support. Thanks to Marcel for the feedback!
=============== Diff against HelpSystem-Core-ct.143 ===============
Item was changed: + ----- Method: SearchTopic>>doSearch (in category 'searching') ----- - ----- Method: SearchTopic>>doSearch (in category 'private') ----- doSearch + "Extension point. Subclasses may override this, e.g., to implement different search strategies."
(self topicsToSearch sorted: [:t1 :t2 | t1 priorityForSearch <= t2 priorityForSearch]) do: [:topic | | nestedResults | nestedResults := OrderedCollection new. self mutex critical: [results add: topic -> nestedResults]. self find: self term in: {topic} results: nestedResults]. + results add: 'Search finished.' translated.! - results add: 'Search finished.'.!
Item was changed: + ----- Method: SearchTopic>>printResultEntry: (in category 'searching') ----- - ----- Method: SearchTopic>>printResultEntry: (in category 'private') ----- printResultEntry: entry
| resultEntry topic | resultEntry := '' asText. topic := entry first last. entry second notNil ifFalse: [resultEntry append: ( (topic title) asText addAttribute: TextEmphasis bold)] ifTrue: [resultEntry append: ( (topic title) asText addAttribute: TextEmphasis bold; addAttribute: (TextColor color: Color green muchDarker) from: entry second first to: entry second last)].
+ resultEntry append: (' ' asText , ('({1})' asText - resultEntry append: (' (open topic)' asText addAttribute: (PluggableTextAttribute evalBlock: [ self changed: #searchResultSelected with: entry first. + self changed: #searchResultContentsSelected with: entry sixth]); + format: {'open topic' translated})). - self changed: #searchResultContentsSelected with: entry sixth])). resultEntry append: String cr. resultEntry append: ( ('> ', ((entry first allButLast collect: [:t | t title]) joinSeparatedBy: ' > ')) asText addAttribute: (TextColor color: (Color gray: 0.7))).
resultEntry append: String cr. entry fourth ifNil: [resultEntry append: '\' withCRs] ifNotNil: [:contents | | text | text := contents asText. text addAttribute: (TextColor color: Color green muchDarker) from: entry third first to: entry third last; addAttribute: TextEmphasis bold from: entry third first to: entry third last. resultEntry append: text withBlanksTrimmed; append: '\' withCRs. ]. ^ resultEntry!
Item was changed: ----- Method: SearchTopic>>startSearch (in category 'private') ----- startSearch
self stopSearch. results := OrderedCollection new. self topicsToSearch ifEmpty: [ self changed: #contents. ^ self]. process := [ - self doSearch. + self triggerUpdateContents + ] forkAt: Processor userBackgroundPriority.! - - self triggerUpdateContents. - - ] forkAt: 35.!
Item was changed: + ----- Method: SearchTopic>>updateContents (in category 'searching') ----- - ----- Method: SearchTopic>>updateContents (in category 'private') ----- updateContents
self mutex critical: [ updatePending := false ].
resultText := nil. self changed: #contents with: self.!
Item was changed: + ----- Method: SearchTopic>>writeResultText (in category 'searching') ----- - ----- Method: SearchTopic>>writeResultText (in category 'private') ----- writeResultText + "Extension point. Subclasses may override this, e.g., to customize the representation of results."
results ifNil: [^ resultText]. results do: [:topicToResult | topicToResult isString ifTrue: [resultText append: ( (topicToResult, String cr) asText addAttribute: (TextColor color: (Color gray: 0.7)); yourself)] ifFalse: [ resultText append: ( + '----- Matches found in ''{1}'' -----\' withCRs translated asText + addAttribute: (TextColor color: (Color gray: 0.7)); + format: {topicToResult key title}). - ('----- Matches found in ''', topicToResult key title, ''' -----\') withCRs asText - addAttribute: (TextColor color: (Color gray: 0.7))). topicToResult value do: [:entry | resultText append: (self printResultEntry: entry)] ]]!
packages@lists.squeakfoundation.org