Skip to content

Commit

Permalink
fix: preparse template before rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
sywhb committed May 12, 2023
1 parent 957bbca commit c41bc8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
} from "./settings";
import { FolderSuggest } from "./settings/file-suggest";
import {
preParseTemplate,
renderArticleContnet,
renderAttachmentFolder,
renderFilename,
Expand Down Expand Up @@ -152,6 +153,9 @@ export default class OmnivorePlugin extends Plugin {

new Notice("🚀 Fetching articles ...");

// pre-parse template
preParseTemplate(template);

const size = 50;
for (
let hasNextPage = true, articles: Article[] = [], after = 0;
Expand Down
4 changes: 4 additions & 0 deletions src/settings/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,7 @@ export const renderFolderName = (folder: string, folderDate: string) => {
date: folderDate,
});
};

export const preParseTemplate = (template: string) => {
Mustache.parse(template);
};

0 comments on commit c41bc8f

Please sign in to comment.