Skip to content

Commit

Permalink
🔧 Remove internal from download frontmatter
Browse files Browse the repository at this point in the history
  • Loading branch information
fwkoch committed Apr 4, 2024
1 parent d56135d commit 2798f00
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
5 changes: 2 additions & 3 deletions packages/myst-cli/src/build/site/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function resolveSiteAction(
url: action.url,
filename: action.filename,
format: action.format,
internal: action.internal ?? isInternalUrl(action.url),
internal: isInternalUrl(action.url),
static: false,
};
}
Expand Down Expand Up @@ -324,7 +324,7 @@ function resolveSiteAction(
url: action.url,
filename: action.filename,
format: action.format,
internal: action.internal ?? isInternalUrl(action.url),
internal: isInternalUrl(action.url),
static: false,
};
}
Expand Down Expand Up @@ -359,7 +359,6 @@ function resolveSiteAction(
url: `/${fileHash}`,
filename,
format: action.format ?? EXT_TO_FORMAT[path.extname(resolvedFile)],
internal: action.internal,
static: true,
};
}
Expand Down
19 changes: 17 additions & 2 deletions packages/myst-frontmatter/src/downloads/downloads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cases:
- format: md
normalized: {}
errors: 1
- title: full download object passes
- title: cannot set internal
raw:
downloads:
- url: my-file.pdf
Expand All @@ -49,4 +49,19 @@ cases:
format: md
title: My File
static: true
internal: false
warnings: 1
- title: full download object passes
raw:
downloads:
- url: my-file.pdf
format: md
title: My File
static: true
filename: file.md
normalized:
downloads:
- url: my-file.pdf
format: md
title: My File
static: true
filename: file.md
1 change: 0 additions & 1 deletion packages/myst-frontmatter/src/downloads/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ export type Download = {
id?: string;
url?: string;
filename?: string;
internal?: boolean;
static?: boolean;
};
5 changes: 1 addition & 4 deletions packages/myst-frontmatter/src/downloads/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { Download } from './types.js';

const DOWNLOAD_KEY_OBJECT = {
required: [],
optional: ['title', 'url', 'id', 'filename', 'format', 'internal', 'static'],
optional: ['title', 'url', 'id', 'filename', 'format', 'static'],
alias: {
ref: 'id',
file: 'url',
Expand Down Expand Up @@ -48,9 +48,6 @@ export function validateDownload(input: any, opts: ValidationOptions): Download
if (defined(value.format)) {
output.format = validateExportFormat(value.format, incrementOptions('format', opts));
}
if (defined(value.internal)) {
output.internal = validateBoolean(value.internal, incrementOptions('internal', opts));
}
if (defined(value.static)) {
output.static = validateBoolean(value.static, incrementOptions('static', opts));
}
Expand Down

0 comments on commit 2798f00

Please sign in to comment.