Impleting find and replace.
This commit is contained in:
parent
973d6c2c76
commit
9b91900dda
@ -420,6 +420,12 @@ GrafoscopioNode >> exportPreambleTo: aStream [
|
||||
aStream nextPutAll: 'abstract: ', '|'; lf; nextPutAll: (configDict at: 'abstract'); lf]
|
||||
]
|
||||
|
||||
{ #category : #utility }
|
||||
GrafoscopioNode >> find: aString andReplaceWith: anotherString [
|
||||
anotherString ifNil: [ ^ self ].
|
||||
self body: ((self body) copyReplaceAll: aString with: anotherString)
|
||||
]
|
||||
|
||||
{ #category : #exporting }
|
||||
GrafoscopioNode >> flatten [
|
||||
"I traverse the tree looking for node bodies containing 'Text' objects and transform them to
|
||||
|
@ -33,6 +33,16 @@ GrafoscopioNodeTest >> testDemoteNode [
|
||||
|
||||
]
|
||||
|
||||
{ #category : #tests }
|
||||
GrafoscopioNodeTest >> testFindAndReplace [
|
||||
| tree |
|
||||
tree := GrafoscopioNode new.
|
||||
tree body: 'I''m only a test node.'.
|
||||
tree find: 'only' andReplaceWith: 'JUST'.
|
||||
self assert: (tree body findString: 'JUST') > 0.
|
||||
|
||||
]
|
||||
|
||||
{ #category : #tests }
|
||||
GrafoscopioNodeTest >> testHasMarkdownSubtreesToExport [
|
||||
"Because becomeDefaultTestTree contains at least one non empty 'links' object that
|
||||
|
Loading…
Reference in New Issue
Block a user