Skip to content

Commit

Permalink
fix resources path
Browse files Browse the repository at this point in the history
  • Loading branch information
demarey committed May 15, 2024
1 parent 5051687 commit 625a2e3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Microdown-Agenda-Tests/MicAgendaGeneratorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ MicAgendaGeneratorTest >> testAgendaHtmlIsGeneratedInRightDirectoryWhenAbsoluteF

self assert: generator resourcesOutputDir equals: FileLocator workingDirectory / 'generated' / 'resources'.
self assert: generator outputFile equals: FileLocator root / 'foo' / 'bar' / 'agenda.html'.
self assert: generator generatedResourcesPath equals: './resources'
]

{ #category : #tests }
Expand All @@ -199,6 +200,7 @@ MicAgendaGeneratorTest >> testAgendaHtmlIsGeneratedInRightDirectoryWhenRelativeF

self assert: generator resourcesOutputDir equals: FileLocator workingDirectory / 'generated' / 'resources'.
self assert: generator outputFile equals: FileLocator workingDirectory / 'generated' / 'foo' / 'bar' / 'agenda.html'.
self assert: generator generatedResourcesPath equals: '../../resources'
]

{ #category : #tests }
Expand Down
21 changes: 19 additions & 2 deletions src/Microdown-Agenda/MicAgendaGenerator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ MicAgendaGenerator >> dayTalksTemplate [
^ self templatesDir / 'dayTalks.mustache'
]

{ #category : #building }
{ #category : #private }
MicAgendaGenerator >> ensureOutputFileParentCreated: aFileReference [

self outputDir ensureCreateDirectory.
Expand All @@ -126,6 +126,22 @@ MicAgendaGenerator >> ensureOutputFileParentCreated: aFileReference [
aFileReference parent ensureCreateDirectory
]

{ #category : #accessing }
MicAgendaGenerator >> generatedResourcesPath [

| nbNestedFolders resourcesPathString |

self outputFile isAbsolute ifTrue: [ ^ './resources' ].

nbNestedFolders := (self outputFile relativeTo: self outputDir) segments size - 1.
resourcesPathString := ''.
nbNestedFolders timesRepeat: [ resourcesPathString := '../' , resourcesPathString ].
^ resourcesPathString
ifEmpty: [ './resources' ]
ifNotEmpty: [ resourcesPathString , 'resources' ]

]

{ #category : #private }
MicAgendaGenerator >> gitRepositoryDir [

Expand Down Expand Up @@ -230,7 +246,8 @@ MicAgendaGenerator >> visitAgenda: anAgenda [
('HAS_ABSTRACT' -> self abstractLink notNil).
('ABSTRACT_LINK' -> self abstractLink).
('DAYS_HEADER_BLOCK_HTML' -> daysHeaderBlockHtml).
('DAYS_HTML' -> daysHtml) } asDictionary.
('DAYS_HTML' -> daysHtml).
('RESOURCES_PATH' -> self generatedResourcesPath) } asDictionary.
canvas nextPutAll: agenda
]
Expand Down

0 comments on commit 625a2e3

Please sign in to comment.