Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/GToolkit-Documenter/GtDocumenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ GtDocumenter class >> forFile: aFileReference [
^ self new fileReference: aFileReference; read
]

{ #category : #'instance creation' }
GtDocumenter class >> forPackage: anRPackage [
^ self new packageComment: anRPackage; read
]

{ #category : #'instance creation' }
GtDocumenter class >> forText: aStringOrText [
^ self new text: aStringOrText
Expand Down Expand Up @@ -408,6 +413,12 @@ GtDocumenter >> normalFontSize: aNumber [
self editorElement normalFontSize: aNumber.
]

{ #category : #'api - storage' }
GtDocumenter >> packageComment: anRPackage [
self editorElement packageComment: anRPackage.
self updateTitleLabel.
]

{ #category : #'api - ast' }
GtDocumenter >> parse [
^ self ast
Expand Down
5 changes: 5 additions & 0 deletions src/GToolkit-Documenter/GtDocumenterEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ GtDocumenterEditor >> normalFontSize: aNumber [
normalFontSizeModel normalFontSize: aNumber
]

{ #category : #'api - storage' }
GtDocumenterEditor >> packageComment: anRPackage [
storageModel packageComment: anRPackage
]

{ #category : #'api - storage' }
GtDocumenterEditor >> read [
^ storageModel read
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ GtDocumenterEditorStorageModel >> notifyStorageChanged [
storage: self storage)
]

{ #category : #'api - storage' }
GtDocumenterEditorStorageModel >> packageComment: anRPackage [
self
assert: [ anRPackage notNil ]
description: [ 'Package to document must be non-nil' ].
self storage: (GtStorageStrategy packageComment: anRPackage)
]

{ #category : #'api - storage' }
GtDocumenterEditorStorageModel >> read [
self widgetDo: [ :aDocumenter |
Expand Down
77 changes: 77 additions & 0 deletions src/GToolkit-Documenter/GtPackageCommentStrategy.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
Class {
#name : #GtPackageCommentStrategy,
#superclass : #GtStorageStrategy,
#instVars : [
'package'
],
#category : #'GToolkit-Documenter-Storage'
}

{ #category : #accessing }
GtPackageCommentStrategy >> basename [
"Return a string representing the document filename"
<return: #String>
^ self name, '.', GtFileUtilityConstants pillarExtension
]

{ #category : #accessing }
GtPackageCommentStrategy >> comment [
<return: #String>
^ self packageToComment packageManifestOrNil
ifNil: [ '' ]
ifNotNil: [ :manifest |
manifest hasComment
ifTrue: [ manifest comment ]
ifFalse: [ '' ] ]
]

{ #category : #accessing }
GtPackageCommentStrategy >> evaluationReceiver [
"Return an object that is used as a receiver (self) in a codeblock (code snippet) evalution"
<return: #Object>
^ self packageToComment
]

{ #category : #testing }
GtPackageCommentStrategy >> exists [
<return: #Boolean>
^ true
]

{ #category : #accessing }
GtPackageCommentStrategy >> name [
"Return a string representing the stored document"
<return: #String>
^ self packageToComment name
]

{ #category : #accessing }
GtPackageCommentStrategy >> packageToComment [
^ package
]

{ #category : #accessing }
GtPackageCommentStrategy >> packageToComment: anRPackage [
self
assert: [ anRPackage notNil ]
description: [ 'Package to document must be non-nil' ].
package := anRPackage
]

{ #category : #actions }
GtPackageCommentStrategy >> read: aGt2Document [
aGt2Document text: self comment
]

{ #category : #accessing }
GtPackageCommentStrategy >> rootDirectory [
<return: #FileReference>
^ FileSystem workingDirectory
]

{ #category : #actions }
GtPackageCommentStrategy >> save: aGt2Document [
self packageToComment packageManifest
comment: aGt2Document text asString
stamp: Author changeStamp
]
10 changes: 10 additions & 0 deletions src/GToolkit-Documenter/GtStorageStrategy.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ GtStorageStrategy class >> null [
^ GtNoStorageStrategy uniqueInstance
]

{ #category : #factory }
GtStorageStrategy class >> packageComment [
^ GtPackageCommentStrategy new
]

{ #category : #factory }
GtStorageStrategy class >> packageComment: anRPackage [
^ self packageComment packageToComment: anRPackage
]

{ #category : #accessing }
GtStorageStrategy >> basename [
"Return a string representing the document filename"
Expand Down