mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-10 19:03:17 +02:00
Merge branch 'dev' into localization
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
- [#686](https://github.com/estruyf/vscode-front-matter/issues/686): Allow script authors to ask questions during script execution
|
||||
- [#688](https://github.com/estruyf/vscode-front-matter/issues/688): Allow to show the scheduled articles in the content dashboard (filter and group)
|
||||
- [#690](https://github.com/estruyf/vscode-front-matter/issues/690): Added the ability to filter values in the `contentRelationship` field
|
||||
- [#700](https://github.com/estruyf/vscode-front-matter/issues/700): Added the `{{pathToken.relPath}}` placeholder for the `previewPath` property
|
||||
|
||||
### ⚡️ Optimizations
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { dirname, relative } from 'path';
|
||||
import { ContentFolder } from '../models';
|
||||
|
||||
export const processPathPlaceholders = (
|
||||
@@ -7,6 +8,13 @@ export const processPathPlaceholders = (
|
||||
contentFolder: ContentFolder | null | undefined
|
||||
) => {
|
||||
if (value && value.includes('{{pathToken.')) {
|
||||
const relPathToken = '{{pathToken.relPath}}';
|
||||
if (value.includes(relPathToken) && contentFolder?.path) {
|
||||
const dirName = dirname(filePath);
|
||||
let relPath = relative(contentFolder.path, dirName);
|
||||
value = value.replace(relPathToken, relPath);
|
||||
}
|
||||
|
||||
const regex = /{{pathToken.(\d+|relPath)}}/g;
|
||||
const matches = value.match(regex);
|
||||
if (matches) {
|
||||
|
||||
Reference in New Issue
Block a user