The Trunk: HelpSystem-Core-mt.115.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: HelpSystem-Core-mt.115.mcz

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

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

Name: HelpSystem-Core-mt.115
Author: mt
Time: 13 August 2019, 3:48:06.739456 pm
UUID: 4822b284-b8db-9247-b474-e1b5d4fb64d7
Ancestors: HelpSystem-Core-mt.114

Be able to override code styling in help topics. This is useful if you have one introductory page besides a page with source code.

There is no need for CodeStyledHelpTopic anymore. Remove or deprecate? See SqueakTutorials class >> #usefulExpressions .

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

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].
 
  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 cr; nextPutAll: (String streamContents:[:c| c nextChunkPutWithStyle: newContents]) storeString.
  s nextPutAll:' readStream nextChunkText)'.
 
  indirect ifFalse: [
+ subtopic key ifNotNil: [s crtab: 3; nextPutAll: 'key: ', subtopic key storeString; nextPutAll: ';'].
+ subtopic shouldStyle ifNotNil: [s crtab: 3; nextPutAll: 'shouldStyle: ', subtopic shouldStyle storeString; nextPutAll: ';'].
+ s crtab: 3; nextPutAll: 'yourself']
- s crtab: 3; nextPutAll: 'key: ', subtopic key storeString].
  ].
 
  topicClass class
  compile: code
  classified: ((topicClass class organization categoryOfElement: topicMethodSelector) ifNil:['pages']).!

Item was changed:
  ----- Method: ClassBasedHelpTopic>>updateSubtopics (in category 'updating') -----
  updateSubtopics
  "build a list of subtopics; start with the list of page names specified by the helpClass' #pages method, remembering that it is an ordered list of
  - selectors that return a HelpTopic,
  -  or the name of a class that must in turn provide help topics etc. This allows for hierarchies with 'subtrees in the middle'.
  The order of the pages reflects the order of the selectors and class names given.
  Then all the subclasses that are not #ignore'd and not already included are added.
  Finally the list of class names and messages is used to assemble the actual help topics.
 
  Questions:
  is it actually useful to include the possibility of class names as per the CustomHelpHelpBuilder>createTopicFrom: code?
  is the #ignore testing worth keeping?"
 
  | pages |
  pages := (self helpClass pages collect: [:pageSelectorOrClassName |
  (Smalltalk hasClassNamed: pageSelectorOrClassName asString)
  ifTrue: [Smalltalk classNamed: pageSelectorOrClassName asString]
  ifFalse: [pageSelectorOrClassName]]) asOrderedCollection.
 
  self helpClass subclasses
  select: [:cls | cls ignore not]
  thenDo: [:cls | pages addIfNotPresent: cls].
 
  ^ subtopics := pages withIndexCollect: [:pageSelectorOrClass :priority |
  pageSelectorOrClass isBehavior
+ ifFalse: [(self helpClass perform: pageSelectorOrClass)
+ priority: priority - pages size;
+ key: pageSelectorOrClass;
+ in: [:topic |
+ "Use my choice of styling if my subtopics do not care."
+ topic shouldStyle ifNil: [topic shouldStyle: self usesCodeStyling]];
+ yourself]
- ifFalse: [(self helpClass perform: pageSelectorOrClass) priority: priority - pages size; key: pageSelectorOrClass; yourself]
  ifTrue: [pageSelectorOrClass asHelpTopic]]!

Item was added:
+ ----- Method: HelpBrowser>>aboutToStyle: (in category 'styling') -----
+ aboutToStyle: aStyler
+
+ ^ (self currentTopic ifNil: [self currentParentTopic]) usesCodeStyling!

Item was changed:
  AbstractHelpTopic subclass: #HelpTopic
+ instanceVariableNames: 'title key icon contents subtopics priority isEditable shouldStyle'
- instanceVariableNames: 'title key icon contents subtopics priority isEditable'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'HelpSystem-Core-Model'!
 
  !HelpTopic commentStamp: 'mt 3/25/2015 11:27' prior: 0!
  This is a configurable version of a help topic. You can define its contents, title, icon, and subtopics manually.
 
  Help builders make use of this.!

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

Item was added:
+ ----- Method: HelpTopic>>shouldStyle: (in category 'accessing') -----
+ shouldStyle: aBoolean
+ shouldStyle := aBoolean.!

Item was added:
+ ----- Method: HelpTopic>>usesCodeStyling (in category 'testing') -----
+ usesCodeStyling
+
+ ^ self shouldStyle ifNil: [false]!