From: Niki Roo Date: Thu, 13 Jul 2017 16:29:13 +0000 (+0200) Subject: FimfictionApi: improve bbcode description handling X-Git-Tag: fanfix-1.6.0~13 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=d9a94285b568e80cba1d5b85d67829839d1d5029;p=fanfix.git FimfictionApi: improve bbcode description handling --- diff --git a/src/be/nikiroo/fanfix/supported/FimfictionApi.java b/src/be/nikiroo/fanfix/supported/FimfictionApi.java index 1594d5e..59b593e 100644 --- a/src/be/nikiroo/fanfix/supported/FimfictionApi.java +++ b/src/be/nikiroo/fanfix/supported/FimfictionApi.java @@ -159,7 +159,15 @@ class FimfictionApi extends BasicSupport { @Override protected String getDesc(URL source, InputStream in) { - return getKeyJson(json, 0, "type", "story", "description"); + String desc = getKeyJson(json, 0, "type", "story", "description"); + + // TODO: if the description becomes available in html, use it + desc = desc.replace("\\r\\n", "
"); + desc = desc.replace("[i]", "_").replace("[/i]", "_") + .replace("[b]", "*").replace("[/b]", "*"); + desc = desc.replaceAll("\\[[^\\]]*\\]", ""); + + return desc; } @Override