mirror of
https://github.com/cubexy/obsidian-pdf-printer.git
synced 2026-07-22 05:48:03 +00:00
Adjust capture group to allow for brackets in file names
- Adjusted capture group with lazy matching to only fetch the first `[[` - Also adjusted the pdfBuffer list to a const
This commit is contained in:
parent
2f1e934a8d
commit
05929e84ac
1 changed files with 2 additions and 2 deletions
4
main.ts
4
main.ts
|
|
@ -82,7 +82,7 @@ export default class PdfPrinterPlugin extends Plugin {
|
|||
* @returns found file path (something) or null
|
||||
*/
|
||||
private checkPathInput(input: string): string | null {
|
||||
const matches = input.match(/!\[\[([^\]]+)\]\]/); // match ![[something]], -> something (capture group 1)
|
||||
const matches = input.match(/!\[\[(.+?)\]\]/); // match ![[something]], -> something (capture group 1)
|
||||
if (matches && matches[1]) {
|
||||
return matches[1];
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ export default class PdfPrinterPlugin extends Plugin {
|
|||
const document = await pdfjs.getDocument(buffer).promise;
|
||||
|
||||
const pages: number = document.numPages;
|
||||
let pdfBuffer: PdfPage[] = [];
|
||||
const pdfBuffer: PdfPage[] = [];
|
||||
|
||||
for (let i = 1; i <= pages; i++) {
|
||||
const page = await document.getPage(i);
|
||||
|
|
|
|||
Loading…
Reference in a new issue