From d9a94285b568e80cba1d5b85d67829839d1d5029 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Thu, 13 Jul 2017 18:29:13 +0200 Subject: [PATCH] FimfictionApi: improve bbcode description handling --- src/be/nikiroo/fanfix/supported/FimfictionApi.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/be/nikiroo/fanfix/supported/FimfictionApi.java b/src/be/nikiroo/fanfix/supported/FimfictionApi.java index 1594d5e1..59b593ec 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 -- 2.27.0