Comparing version 2.0.5 to 2.1.0
@@ -20,2 +20,24 @@ 'use strict'; | ||
/* | ||
LaTeX cannot handle remote images, only local ones. | ||
\includegraphics crashes with filenames that contain more than one `.`, | ||
the workaround is \includegraphics{/path/to/{image.foo}.jpg} | ||
*/ | ||
if (node.url) { | ||
var pathParts = node.url.split('/'); | ||
var filename = pathParts.pop(); | ||
if (filename.includes('.')) { | ||
var filenameParts = filename.split('.'); | ||
var extension = filenameParts.pop(); | ||
var basename = filenameParts.join('.'); | ||
var safeBasename = basename.includes('.') ? '{' + basename + '}.' + extension : basename + '.' + extension; | ||
pathParts.push(safeBasename); | ||
node.url = '' + pathParts.join('/'); | ||
} | ||
} | ||
var macro = options.image ? options.image : defaultMacro; | ||
@@ -22,0 +44,0 @@ if (parent.type === 'paragraph' && parent.children.length - 1) { |
{ | ||
"name": "rebber", | ||
"version": "2.0.5", | ||
"version": "2.1.0", | ||
"description": "Stringifies MDAST to LaTeX", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/zestedesavoir/zmarkdown/tree/master/packages/rebber", |
@@ -18,2 +18,26 @@ /* Expose. */ | ||
/* | ||
LaTeX cannot handle remote images, only local ones. | ||
\includegraphics crashes with filenames that contain more than one `.`, | ||
the workaround is \includegraphics{/path/to/{image.foo}.jpg} | ||
*/ | ||
if (node.url) { | ||
const pathParts = node.url.split('/') | ||
const filename = pathParts.pop() | ||
if (filename.includes('.')) { | ||
const filenameParts = filename.split('.') | ||
const extension = filenameParts.pop() | ||
const basename = filenameParts.join('.') | ||
const safeBasename = basename.includes('.') | ||
? `{${basename}}.${extension}` | ||
: `${basename}.${extension}` | ||
pathParts.push(safeBasename) | ||
node.url = `${pathParts.join('/')}` | ||
} | ||
} | ||
let macro = options.image ? options.image : defaultMacro | ||
@@ -20,0 +44,0 @@ if (parent.type === 'paragraph' && parent.children.length - 1) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42645
1126