fix captions for galleries and images

Gallery captions we have to parse
images captions we have to replace links
Can you add a check for `caption` to prevent
```
PHP Notice: Undefined index: caption in /usr/wikia/source/app/extensions/wikia/ArticleAsJson/ArticleAsJson.class.php on line 178
```