Skip to content
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

Re-ordered image params syntax #303

Open
ghost opened this issue Aug 29, 2019 · 3 comments
Open

Re-ordered image params syntax #303

ghost opened this issue Aug 29, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Aug 29, 2019

Hello. Thank you very much for your work. You did the great job. In my work I use your module a lot. Today I fond a small issue, it is very important to me.
In a few cases when I make request for example:
var wtf = require('wtf_wikipedia');
wtf.fetch('Michelle Obama', 'en', (err, doc) => {
console.log(JSON.stringify(doc.images()));
});
returns wrong images caption
Screen Shot 2019-08-29 at 12 51 03

It would be very nice if you can fix it. Thank you very much

@spencermountain
Copy link
Owner

hey Pavlo, thanks.
ya, this is a weird one. I've never seen this syntax before:

[[File:Barack Obama family portrait 2011.jpg|thumb|left|Official portrait by [[Pete Souza]] of the Obama family in the [[Oval Office]], December 11, 2011.|234x234px]]

according to the File: spec:

[[File:Name|Type|Border|Location|Alignment|Size|link=Link|alt=Alt|page=Page|lang=Langtag|Caption]]

it seems invalid, to me! I'm not sure how to change this without breaking all other image captions.

If it's invalid syntax on the page, you may be able to edit the wikipedia page.

if anyone else has seen that usage of File: somewhere, please let me know.
sorry bout that
-spencer

@PlNG
Copy link

PlNG commented Oct 29, 2019

@spencermountain It says right there?

(except for filename) The other details are optional and can be placed in any order.

Or is the confusion about |234x234px? That specifies max width or height while retaining aspect ratio.

Basically if it doesn't fit the pattern of an option, it is regarded as a caption, and that best practice is to place the caption last.

@spencermountain
Copy link
Owner

ah, I didn't see that. thanks.

yikes.

so i guess we should validate for things like (left|thumb|frame) or =, then fallback to caption, if one of these is invalid?

Sometimes I think this wiki syntax is a game on hard-mode.

@spencermountain spencermountain changed the title Issue with images caption Re-ordered image params syntax Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants