Preview
Issue #4
- Anvar Jamgirov 🇵🇸
- Scripts on this site do nothing with @data-caption. You can check them all and try to find something like you do.
Every image in news section has @data-caption attr and it never used.
This text is close to the image only because they're in the same pararaph. There are no CSS-rules for captions.
So, here we can see only simple paragraph with text & image. Doing a job you did is unnecessary because even site's owner haven't do it.
https://instantview.telegram.org/contest/keralakaumudi.com/template42/issue1/
- Type of issue
- IV page is missing essential content
- Reported
- Mar 29, 2019
It is possible to reliably identify image captions.
In the source:
<p>
<img data-caption="CAPTION TEXT">
"CAPTION TEXT
</p>
If p/@data-caption=p/text(),
then replace <p> with <figure> and wrap ./text() in <figcaption>
In practice, it is implemented a little more difficult.
It is necessary to convert @ data-caption to text before comparison. You can also check if <p> have other children.
It works great in my template.
The solution is reliable because:
1. Where there is no signature to the image, it will not be in IV.
Despite the fact that the text is in @data-caption
2. If the paragraph contains another text (not a figcaption) - it will not be lost
3. It is hardly possible to imagine a situation when this approach does not work.