mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-07-06 01:41:48 +02:00
#664 - Draft status parsing fix
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
- [#660](https://github.com/estruyf/vscode-front-matter/issues/660): Allow only to select unique content relationship values
|
||||
- [#661](https://github.com/estruyf/vscode-front-matter/issues/661): Fixing the dropdowns when used at the bottom of a collapsible group
|
||||
- [#664](https://github.com/estruyf/vscode-front-matter/issues/664): Fix for parsing draft status in Hexo and Jekyll
|
||||
|
||||
## [9.2.0] - 2023-09-11
|
||||
|
||||
|
||||
@@ -46,16 +46,21 @@ export default function usePages(pages: Page[]) {
|
||||
// Framework specific actions
|
||||
if (framework?.toLowerCase() === 'jekyll' || framework?.toLowerCase() === 'hexo') {
|
||||
pagesToShow = pagesToShow.map((page) => {
|
||||
// https://jekyllrb.com/docs/posts/#drafts
|
||||
const filePath = parseWinPath(page.fmFilePath);
|
||||
page.draft = filePath.indexOf(`/_drafts/`) > -1;
|
||||
try {
|
||||
const crntPage = Object.assign({}, page);
|
||||
// https://jekyllrb.com/docs/posts/#drafts
|
||||
const filePath = parseWinPath(page.fmFilePath);
|
||||
crntPage.draft = filePath.indexOf(`/_drafts/`) > -1;
|
||||
|
||||
// Published field: https://jekyllrb.com/docs/front-matter/#predefined-global-variables
|
||||
if (typeof page.published !== 'undefined') {
|
||||
page.draft = !page.published;
|
||||
// Published field: https://jekyllrb.com/docs/front-matter/#predefined-global-variables
|
||||
if (typeof crntPage.published !== 'undefined') {
|
||||
crntPage.draft = !crntPage.published;
|
||||
}
|
||||
|
||||
return crntPage;
|
||||
} catch (error) {
|
||||
return page;
|
||||
}
|
||||
|
||||
return page;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user