Remove global configuration and improve printing

This commit is contained in:
Christoph Hagen
2022-12-01 15:19:17 +01:00
parent 58eae51d40
commit 94375f3a81
5 changed files with 48 additions and 12 deletions

View File

@ -120,11 +120,10 @@ struct PageContentGenerator {
private func handleImage(page: Element, file: String, rightTitle: String?, leftTitle: String?) -> String {
let imagePath = page.pathRelativeToRootForContainedInputFile(file)
let size = files.requireMultiVersionImage(
let size = files.requireFullSizeMultiVersionImage(
source: imagePath,
destination: imagePath,
requiredBy: page.path,
width: configuration.pageImageWidth)
requiredBy: page.path)
let content: [PageImageTemplate.Key : String] = [
.image: file.dropAfterLast("."),

View File

@ -73,9 +73,7 @@ struct PageGenerator {
}
private func makeContent(page: Element, metadata: Element.LocalizedMetadata, language: String, path: String) -> (content: String, includesCode: Bool, isEmpty: Bool) {
let create = configuration.createMdFilesIfMissing
if let raw = files.contentOfOptionalFile(atPath: path, source: page.path, createEmptyFileIfMissing: create)?
.trimmed.nonEmpty {
if let raw = files.contentOfMdFile(atPath: path, source: page.path)?.trimmed.nonEmpty {
let (content, includesCode) = PageContentGenerator(factory: factory.factory)
.generate(page: page, language: language, content: raw)
return (content, includesCode, false)