Skip to content

Commit

Permalink
Use LibraryExporter.exportAll in pipeline initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgio committed Aug 11, 2024
1 parent 17d19a0 commit 7158057
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package eu.iamgio.quarkdown.cli

import eu.iamgio.quarkdown.context.MutableContext
import eu.iamgio.quarkdown.flavor.MarkdownFlavor
import eu.iamgio.quarkdown.function.library.Library
import eu.iamgio.quarkdown.function.library.LibraryExporter
import eu.iamgio.quarkdown.log.DebugFormatter
import eu.iamgio.quarkdown.log.Log
import eu.iamgio.quarkdown.pipeline.Pipeline
Expand All @@ -23,7 +25,7 @@ object PipelineInitialization {
options: PipelineOptions,
): Pipeline {
// Libraries to load.
val libraries = setOf(Stdlib.library)
val libraries: Set<Library> = LibraryExporter.exportAll(Stdlib)

// Actions run after each stage of the pipeline.
val hooks =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,13 @@ interface LibraryExporter {
* The library to export and hand to the pipeline.
*/
val library: Library

companion object {
/**
* Loads libraries from the given exporters.
* @param exporters library exporters
* @return set of exported libraries from the given exporters
*/
fun exportAll(vararg exporters: LibraryExporter): Set<Library> = exporters.map { it.library }.toSet()
}
}

0 comments on commit 7158057

Please sign in to comment.