-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from curvenote/fix/dedupe-bibtex
fix/dedupe bibtex
- Loading branch information
Showing
7 changed files
with
153 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { sync as which } from 'which'; | ||
import path from 'path'; | ||
import { Logger } from 'logging'; | ||
import { makeExecutable } from './exec'; | ||
|
||
export function isInkscapeAvailable() { | ||
return which('inkscape', { nothrow: true }); | ||
} | ||
|
||
export async function convertSVGToPDF( | ||
svg: string, | ||
log: Logger, | ||
buildPath: string, | ||
): Promise<string | null> { | ||
const dirname = path.dirname(svg); | ||
const basename = path.basename(svg, path.extname(svg)); | ||
const pdf = path.join(dirname, `${basename}.pdf`); | ||
const convert = makeExecutable( | ||
`inkscape ${path.join(buildPath, svg)} --export-area-drawing --export-pdf=${path.join( | ||
buildPath, | ||
pdf, | ||
)}`, | ||
log, | ||
); | ||
try { | ||
await convert(); | ||
} catch (err) { | ||
log.error(`Could not convert SVG to PDF ${err}`); | ||
return null; | ||
} | ||
return pdf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters