In most cases, a line in a pictures-group contains enough pictures or at
least in the correct format (usually in landscape mode) to actually make
the browser call flex-shrink.
However, in a few specific cases, when pictures do not fill the flex
container, there is some space left on the right side of the line which
could be filled in.
In that case, we can use the flex-grow property. To be able to keep
everything aligned, we need to set the flex-grow property according to
the ratio of the picture so that all pictures in the line are grown
proportionally.
Adding this alignment fix required a bit of re-ordering so we could call
the ratio property for the div of class `picture`.
Fixes#92
Signed-off-by: Quentin Schulz <foss@0leil.net>
To prepare for an alignment fix that requires to know the ratio of the
video screenshot, let's add a ratio property.
This property is calling `ffprobe` or `avprobe` depending on whether
ffmpeg or libav-tools was installed. It is not adding a new dependency.
The output of this particular `ffprobe` or `avprobe` returns the width
and height of the video, separated by a comma.
Signed-off-by: Quentin Schulz <foss@0leil.net>
To prepare for an alignment fix that requires to know the ratio of the
image, let's add a ratio property.
This property is calling `gm identify` which is already a dependency of
prosopopee.
The output of this particular `gm identify` returns the width and height
separated by a comma.
Signed-off-by: Quentin Schulz <foss@0leil.net>
We want to distinguish between URI references ("local" pages), such as
path/to/another/page/of/my/website, from the other ones, such as
https://example.com in the menu to know how to build the URL.
The issue is that we did the distinction between the two by checking if
the string starts with "http".
Unfortunately, it does not match other valid URI schemes. One example is
mailto:address@example.com to open a mail client with the recipient
being address@example.com.
There are many other valid URI schemes (tel, ftp, irc, ...).
Under the current code, we think anything that isn't started by "http"
is local, i.e. we need to append the string to the parent path of the
current page.
This means that we have
https://mywebsite.example.com/mailto:address@example.com linked in the
menu instead of the expected mailto:address@example.com.
Let's fix that with a very simple test. A URI reference is commonly
detected as anything that does not contain a scheme (which has to be
suffixed by ':') or if it does, that the given path starts with './'.
This is most likely not handling all the cases but at least most of the
common ones.
Please refer to the RFC for further information:
https://www.rfc-editor.org/rfc/rfc3986.txt
Signed-off-by: Quentin Schulz <foss@0leil.net>