Skip to content

Commit

Permalink
fix: don't mutate attributes
Browse files Browse the repository at this point in the history
subsquent calls will have the mutated options
  • Loading branch information
saneef committed Nov 28, 2023
1 parent 6a73e8c commit 42dcfc5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/eleventy-asciidoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ function eleventyAsciidoctor(convertOptions = {}) {

let { base_dir, configure_extension_registry } = options;
const attributes = parseDocumentAttributes(options.attributes ?? {});
const { outdir } = attributes;
let { outdir } = attributes;

base_dir = base_dir === undefined ? path.dirname(inputPath) : base_dir;

if (outdir === undefined) {
const { page } = data ?? {};
const { outputPath } = page ?? {};
if (outputPath !== undefined) {
attributes.outdir = path.dirname(outputPath);
outdir = path.dirname(outputPath);
}
}

Expand All @@ -101,6 +101,7 @@ function eleventyAsciidoctor(convertOptions = {}) {
...options,
attributes: {
...attributes,
outdir,
},
base_dir,
extension_registry: registry,
Expand Down

0 comments on commit 42dcfc5

Please sign in to comment.