-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
images displayed at the end of file #20
Comments
The PIL library the code uses works for displaying images in Jupyter Notebook, but I think Quarto doesn't understand that it is dealing with images if they're in that format. Without that information it can't convert them like it should and puts them at the very end of the PDF without doing anything to them. The simplest solution is to put the images into Markdown format instead so that Quarto recognises them correctly: def get_img(partOfItem_id):
q = ""
if partOfItem_id:
q = query_img.replace("<placeholder>", "?partOfStatement cpsps:P6 cps:"+partOfItem_id+".")
else:
q = query_img.replace("<placeholder>","")
results_img = run_query(endpoint_url, q)
for item in results_img["results"]["bindings"]:
title = item['itemLabel']['value']
description = html.unescape(item['itemDescr']['value'])
print('\nWikibase link: ' + '[' + item['imgItem']['value'] + ']' + '(' + item['imgItem']['value'] + ')' + '\n')
print('Title: ' + title + '\n')
print('Year: ' + item['publishDate']['value'] + '\n')
print('Description: ' + description + '\n')
# get image from image URL
image_url=item['imgUrl']['value']
# display image with title + alt text (in markdown)
print('!['+ title +']('+image_url+'){fig-alt="'+description+'"}\n\n')
The above snippet replaces the Since this doesn't use the PIL library anymore, this: from PIL import Image
from datetime import datetime
import time and the |
FYI - checking on local rendering and PDF image rendering at end of doc - I now find an inconsistency with images now working in PDF. We will still carry out our fix as we want to be sure things work. The repo is https://github.com/TIBHannover/section-demo - This is just to log the observation - #23 |
possibly caused by PIL. markdown syntax might be better
The text was updated successfully, but these errors were encountered: