Closed gsrohde closed 8 years ago
Are you sure your markup is correctly typed? " )) " seems to be incorrectly ordered on your example...
@markomanninen You're correct that my example is incorrect. What I meant to type was
![{{page.Figures.SearchBox.Caption}}]({{page.Figures.SearchBox.ImageFile}})
The double curly braces ({{ ... }}
) dereference the variables. This works correctly in the case of the image file but not for the caption.
Hi @gsrohde, Thanks for your error report! This is caused by different handling of url of image and caption. Caption has been till now read before any variables / templates interpolation took place. This caption has been then used to wrap already interpolated image (and src) later.
It is fixed since release 3.1.0
and your example is used as a basis for following test.
Please give it a try and let me know, if everything works as expected.
@markomanninen: thank you for your feedback and quick reaction. If you want to look at the implementation - I simply moved the retrieving of title
|| alt
image attribute to the postprocessing phase, where the content of the attribute is already interpolated. All the existing tests are passing, so hopefully nothing will break. This could probably interfere with images lists, where caption is collected before any interpolation. I don't know if we should handle this specific case too.
Thanks and best regards, Tomas
@todvora I didn't know how to run the test but I did try my use case with the new release and it worked. Thank you for fixing this so promptly.
I did have a bit of trouble when I first tried to update it:
srohde:betydb-data-access srohde$ gitbook install
info: installing 2 plugins using npm@3.9.2
info:
info: installing plugin "footnote-string-to-number"
info: install plugin "footnote-string-to-number" (*) from NPM with version 0.0.2
info: >> plugin "footnote-string-to-number" installed with success
info:
info: installing plugin "image-captions"
info: install plugin "image-captions" (*) from NPM with version 3.1.0
internal/child_process.js:313
throw errnoException(err, 'spawn');
^
Error: spawn E2BIG
at exports._errnoException (util.js:1026:11)
at ChildProcess.spawn (internal/child_process.js:313:11)
at exports.spawn (child_process.js:385:9)
at spawn (/Users/srohde/.gitbook/versions/3.2.2/node_modules/npm/lib/utils/spawn.js:7:13)
at runCmd_ (/Users/srohde/.gitbook/versions/3.2.2/node_modules/npm/lib/utils/lifecycle.js:237:14)
at runCmd (/Users/srohde/.gitbook/versions/3.2.2/node_modules/npm/lib/utils/lifecycle.js:196:5)
at runPackageLifecycle (/Users/srohde/.gitbook/versions/3.2.2/node_modules/npm/lib/utils/lifecycle.js:160:3)
at Array.<anonymous> (/Users/srohde/.gitbook/versions/3.2.2/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
at LOOP (/Users/srohde/.gitbook/versions/3.2.2/node_modules/npm/node_modules/slide/lib/chain.js:15:14)
at chain (/Users/srohde/.gitbook/versions/3.2.2/node_modules/npm/node_modules/slide/lib/chain.js:20:5)
I tried removing the other plugin in the book.json file ("footnote-string-to-number"), re-running gitbook install
, and then restoring the plugin I removed. This seemed to work. Whether or not the other plugin really was causing the problem I can't be certain.
Hi @gsrohde,
I did try my use case with the new release and it worked
Perfect, thank you for that. No worries about tests, your use case is what matters.
The Error: spawn E2BIG
seems to be somehow related to child_process.spawn()
, which is not part of the plugin. Maybe some Gitbook, Node.js or NPM related problem.
E2BIG: Argument list too long (POSIX.1) Reference: http://man7.org/linux/man-pages/man3/errno.3.html
@SamyPesse: Please, have you seen anything like this stacktrace before? Is there anything I can do about it? Thanks!
Best regards, Tomas
I can't reproduce it and got no additional feedback. So I'm closing this issue now but feel free to reopen it if the problem occurs again.
I define page variables at the top of my file:
and then use them in the page as follows:
The image shows up fine but the caption appears as
{{page.Figures.SearchBox.Caption}}
, that is, the variable is not dereferenced. Is there any solution for this, or are variables not allowed in the caption portion of the image markdown?