Skip to content

gitignore: ignore Bitmap_VS_SVG.svg#128

Open
gucio321 wants to merge 1 commit into
habemus-python:mainfrom
gucio321-studies:add-svg-to-gitignore
Open

gitignore: ignore Bitmap_VS_SVG.svg#128
gucio321 wants to merge 1 commit into
habemus-python:mainfrom
gucio321-studies:add-svg-to-gitignore

Conversation

@gucio321

Copy link
Copy Markdown
Contributor

as mentioned in #98 (comment), #97 (comment) This image is often added in our PRs. I think that, as it is autodownlaoded it should be ignored by git entirely

as mentioned in habemus-python#98 (comment),
habemus-python#97 (comment)
This image is often added in our PRs. I think that, as it is autodownlaoded
it should be ignored by git entirely
@slayoo

slayoo commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

sounds good (although probably even better solution would be to download it to some out-of-repo temporary folder?)

@gucio321

Copy link
Copy Markdown
Contributor Author

although probably even better solution would be to download it to some out-of-repo temporary folder?

Probably yes. I'd even say that this downloading code should not be there. Instead, we should be able to include images like in usual markdown with ![tag](URL) (potentially causes random test crashes)

@slayoo

slayoo commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

the original idea of downloading it on the fly was related with the thesis-in-a-single-file premise...
this still seems to be the only external file needed for the whole project, hence it is tempting to retain it this way

if we want to keep the whole thesis in a single file (which is nice for simplicity, especially given that this is meant to work as a template, and we have little control on how it will be disseminated), we could also include the SVG contents within the notebook (e.g., with the )?

@gucio321

Copy link
Copy Markdown
Contributor Author

if we want to keep the whole thesis in a single file (which is nice for simplicity, especially given that this is meant to work as a template, and we have little control on how it will be disseminated), we could also include the SVG contents within the notebook (e.g., with the )?

But on the other side, if we'd keep the practices of not repeating the code, I think that refering the image with a link sounds better.
This file in fact is not "needed" in the sense that we don't need to ship it with the notebook - it is publically available and in fact should be handled internally by quarto.

@slayoo

slayoo commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

but is there a way to handle the download by Quarto?

@gucio321

gucio321 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Yes! After some testing turns out that the Wikipedia is an issue.
WHen doing e.g. this:

![test1](
https://upload.wikimedia.org/wikipedia/commons/6/6b/Bitmap_VS_SVG.svg)
 (StatusCodeException (Response {responseStatus = Status {statusCode = 403, statusMessage = "Forbidden"}, responseVersion = HTTP/1.1, responseHeaders = [("content-length","126"),("content-type","text/plain"),("x-request-id","6a25f86b-7939-47b2-80a4-e163e8e9cee7"),("server","HAProxy"),("x-cache","cp3081 int"),("x-cache-status","int-tls"),("x-analytics","")], responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose, responseOriginalRequest = Request {
  host                 = "upload.wikimedia.org"
  port                 = 443
  secure               = True
  requestHeaders       = []
  path                 = "/wikipedia/commons/6/6b/Bitmap_VS_SVG.svg"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
  proxySecureMode      = ProxySecureWithConnect
}
, responseEarlyHints = []}) "Please set a user-agent and respect our robot policy https://w.wiki/4wJS. See also https://phabricator.wikimedia.org/T400119.\n")
stack traceback:
	.../share/pandoc/datadir/../../filters/modules/mediabag.lua:29: in function 'modules/mediabag.fetch_and_store_image'
	.../share/pandoc/datadir/../../filters/modules/mediabag.lua:72: in function 'modules/mediabag.resolve_image_from_url'
	(...tail calls...)
	/opt/quarto/share/filters/main.lua:2930: in local 'fn'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:34: in upvalue 'run_filter_function'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:223: in function <...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:202>
	(...tail calls...)
	[C]: in function 'pandoc.List.map'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:125: in upvalue 'recurse'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:222: in local 'jogger'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:98: in upvalue 'recurse'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:222: in function <...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:202>
	(...tail calls...)
	[C]: in function 'pandoc.List.map'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:125: in upvalue 'recurse'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:222: in local 'jogger'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:171: in upvalue 'recurse'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:222: in function <...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:202>
	(...tail calls...)
	/opt/quarto/share/filters/main.lua:574: in function </opt/quarto/share/filters/main.lua:552>
	(...tail calls...)
	/opt/quarto/share/filters/main.lua:1317: in local 'callback'
	/opt/quarto/share/filters/main.lua:1335: in upvalue 'run_emulated_filter_chain'
	/opt/quarto/share/filters/main.lua:1371: in function </opt/quarto/share/filters/main.lua:1368>
WARN: Error encountered when rendering files

Please set a user-agent and respect our robot policy https://w.wiki/4wJS. See also https://phabricator.wikimedia.org/T400119.\n")

But when trying to download some "simply" hosted image:

![test2](https://promat.agh.edu.pl/posts/115858349789616_1398296795672056/main_image.jpg)

It works fine.

To download from wikipedia, we probably should either use some dedicated bot api or force quarto to set it's user-agent to something like Mozilla/5.0 (like the current code does)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants