Skip to content

Commit

Permalink
Merge 9ae0eac
Browse files Browse the repository at this point in the history
  • Loading branch information
quentin.moutte.etu committed Jun 17, 2024
2 parents ee647ff + 9ae0eac commit 9d95bd0
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/Microdown-Blog-Tests/MicBlogCreatorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,22 @@ MicBlogCreatorTest >> testCreateHtmlSummarize [
self assert: (fileSystem / 'html/index.html') exists
]

{ #category : 'tests' }
MicBlogCreatorTest >> testInitializeMonthList [

| listSingleSummarizer |

listSingleSummarizer := Array new: 3.

listSingleSummarizer at:1 put: (MicSingleSummarizer new summarizeFile: fileSystem / 'source/anExample1.md').
listSingleSummarizer at:2 put: (MicSingleSummarizer new summarizeFile: fileSystem / 'source/anExample2.md').
listSingleSummarizer at:3 put: (MicSingleSummarizer new summarizeFile: fileSystem / 'source/test/anExample3.md').

blog initializeMonthList: listSingleSummarizer.

self assert: (fileSystem / 'html/_monthBlog') allFiles size equals: 2.
]

{ #category : 'tests' }
MicBlogCreatorTest >> testRenameMarkdownIntoHtmlFile [

Expand Down
21 changes: 21 additions & 0 deletions src/Microdown-Blog-Tests/MicMonthListCreatorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,24 @@ MicMonthListCreatorTest >> testGenerateMicListBlockOfLinkDateTo [
equals: '[' , Date today month asString , '](/html/_monthBlog/'
, Date today month name , '_' , Date today year asString, '.html)'
]

{ #category : 'tests' }
MicMonthListCreatorTest >> testGenerateMicListBlockOfLinkDateWithTo [

| dateList fileSystem |
fileSystem := FileSystem memory.
fileSystem createDirectory: '/html'.

dateList := MicMonthListCreator new
generateMicListBlockOfLinkDateTo:
fileSystem workingDirectory / '/html'.

self assert: (dateList isKindOf: MicUnorderedListBlock).
self
assert: dateList children size equals: self numberOfMonthSince2014;
assert: dateList children first children first plainText
equals: '[January 2014](/html/_monthBlog/January_2014.html)';
assert: dateList children last children first plainText
equals: '[' , Date today month asString , '](/html/_monthBlog/'
, Date today month name , '_' , Date today year asString , '.html)'
]
26 changes: 26 additions & 0 deletions src/Microdown-Blog/MicBlogCreator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,32 @@ MicBlogCreator >> initialize [
self cssFrameworkName: 'Axist'.
]

{ #category : 'rendering' }
MicBlogCreator >> initializeMonthList: listOfSingleSummarize [

| summar sum date |
sum := MicSummarizer new.
sum targetDirectory: targetDirectory.

dateList := MicMonthListCreator new generateDateListSince2014.
date := dateList copy.

date do: [ :each |
summar := sum group: listOfSingleSummarize byDate: each.
summar isEmpty ifTrue: [ dateList := dateList copyWithout: each ] ].

date := dateList copy.

dateList := MicMonthListCreator new
generateMicListBlockOfLinkDateWith: dateList
To: targetDirectory.

date do: [ :each |
summar := sum group: listOfSingleSummarize byDate: each.
summar := sum summarize: summar.
self createHtmlGroupFile: summar at: each ]
]

{ #category : 'as yet unclassified' }
MicBlogCreator >> levelPathDifferenceForCSS: aStringPath [

Expand Down
10 changes: 8 additions & 2 deletions src/Microdown-Blog/MicMonthListCreator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,20 @@ MicMonthListCreator >> generateDateListSince2014 [
{ #category : 'generate' }
MicMonthListCreator >> generateMicListBlockOfLinkDateTo: aFileReference [

^ self generateMicListBlockOfLinkDateWith: self generateDateListSince2014 To: aFileReference
]

{ #category : 'generate' }
MicMonthListCreator >> generateMicListBlockOfLinkDateWith: aDateList To: aFileReference [

| root link listElement disk |
root := MicUnorderedListBlock new.

(aFileReference fileSystem store isKindOf: WindowsStore) ifTrue: [
disk := 'File:///', aFileReference fileSystem store currentDisk ].
disk := 'File:///' , aFileReference fileSystem store currentDisk ].
disk ifNil: [ disk := '' ].

self generateDateListSince2014 do: [ :each |
aDateList do: [ :each |
listElement := MicListItemBlock new.
link := self
makeALink: each asString
Expand Down

0 comments on commit 9d95bd0

Please sign in to comment.