mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-30 23:06:10 +03:00
Correctly generate with or without index.
This commit is contained in:
parent
9a2f1c3753
commit
2b06f0dc9f
@ -102,7 +102,7 @@ images =
|
||||
{ dillon = (buildImage [ "dillon.jpg" ])
|
||||
, icon = (buildImage [ "icon.svg" ])
|
||||
, mountains = (buildImage [ "mountains.jpg" ])
|
||||
, directory = directoryWithIndex []
|
||||
, directory = directoryWithoutIndex []
|
||||
}
|
||||
|
||||
allImages : List (ImagePath PathKey)
|
||||
|
@ -162,7 +162,8 @@ function formatRecord(directoryPath, rec, asType, level) {
|
||||
var keyVals = [];
|
||||
const indentation = " ".repeat(level * 4);
|
||||
var valsAtThisLevel = [];
|
||||
for (const key of Object.keys(rec)) {
|
||||
const keys = Object.keys(rec);
|
||||
for (const key of keys) {
|
||||
var val = rec[key];
|
||||
|
||||
if (typeof val === "string") {
|
||||
@ -182,9 +183,9 @@ function formatRecord(directoryPath, rec, asType, level) {
|
||||
}
|
||||
}
|
||||
keyVals.push(
|
||||
`directory = directoryWithIndex [${directoryPath
|
||||
.map(pathFragment => `"${pathFragment}"`)
|
||||
.join(", ")}]`
|
||||
`directory = ${
|
||||
keys.includes("index") ? "directoryWithIndex" : "directoryWithoutIndex"
|
||||
} [${directoryPath.map(pathFragment => `"${pathFragment}"`).join(", ")}]`
|
||||
);
|
||||
const indentationDelimiter = `\n${indentation}, `;
|
||||
return `${indentation}{ ${keyVals.join(indentationDelimiter)}
|
||||
|
Loading…
Reference in New Issue
Block a user