Skip to content

Commit

Permalink
Merge pull request #744 from melkiyasser/-fileParser
Browse files Browse the repository at this point in the history
File parser
  • Loading branch information
Ducasse authored May 21, 2024
2 parents 7e05fe3 + c983b3c commit 35858cf
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Microdown/MicRootBlock.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ MicRootBlock >> canConsumeLine: line [
]

{ #category : 'visiting' }
MicRootBlock >> fromFile [
MicRootBlock >> fromFile [ " retieve "
^ self propertyAt: #file .
]

{ #category : 'visiting' }
MicRootBlock >> fromFile: aFile [
MicRootBlock >> fromFile: aFile [ " put file object in the root"
self propertyAt: #file put: aFile .
]

Expand Down
2 changes: 1 addition & 1 deletion src/Microdown/Microdown.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Microdown >> parse: aStreamOrString [
Microdown >> parseFile: aFile [

|root|
root := MicrodownParser parse:((FileSystem workingDirectory / aFile ) readStream contents) .
root := MicrodownParser parse:(aFile contents) .
root fromFile: aFile .
^ root .

Expand Down
30 changes: 30 additions & 0 deletions src/microdown-fileParser/FileParser.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Class {
#name : 'FileParser',
#superclass : 'TestCase',
#category : 'microdown-fileParser',
#package : 'microdown-fileParser'
}

{ #category : 'as yet unclassified' }
FileParser >> testCreatingFileAndParsingtheContent [

| file root |
file := (FileSystem workingDirectory / 'myFile.txt') asFileReference.
file ensureCreateFile.



file writeStreamDo: [ :stream | stream nextPutAll: '
### title
@first
just talking about somthing @*first*@ ' ] .

root := Microdown parseFile: file contents .

self assert: (root isKindOf: MicRootBlock ) .
self assert: root fromFile equals: file contents .
file ensureDelete .


]
1 change: 1 addition & 0 deletions src/microdown-fileParser/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : 'microdown-fileParser' }

0 comments on commit 35858cf

Please sign in to comment.