From 496a2504959c7752264bdc9d2283511f7a76c2dd Mon Sep 17 00:00:00 2001 From: Julius Date: Sun, 22 Dec 2013 12:17:02 +0100 Subject: [PATCH] Rescue on WikiCloth exception --- config/locales/de.yml | 1 + config/locales/en.yml | 1 + lib/foodsoft_wiki/app/helpers/pages_helper.rb | 2 ++ 3 files changed, 4 insertions(+) diff --git a/config/locales/de.yml b/config/locales/de.yml index 146a827f..b2bd925d 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1167,6 +1167,7 @@ de: title_list: Seiten-Liste body: title_toc: Inhalt + wikicloth_exception: Entschuldigung, ein Fehler ist aufgetreten. Möglicherweise ist ein ungewöhnlicher Text die Ursache. Bearbeiten der Seite kann helfen, diesen Fehler zu beseitigen. create: notice: Seite wurde angelegt cshow: diff --git a/config/locales/en.yml b/config/locales/en.yml index 9d6005bc..663d9398 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1171,6 +1171,7 @@ en: title_list: List of pages body: title_toc: Content + wikicloth_exception: An error occured. Sorry for that. It might be that the wiki syntax has been used in an unusual way. Please try to edit the page to get rid of this error. create: notice: Page was created cshow: diff --git a/lib/foodsoft_wiki/app/helpers/pages_helper.rb b/lib/foodsoft_wiki/app/helpers/pages_helper.rb index 552791f3..ce3eb246 100644 --- a/lib/foodsoft_wiki/app/helpers/pages_helper.rb +++ b/lib/foodsoft_wiki/app/helpers/pages_helper.rb @@ -4,6 +4,8 @@ module PagesHelper def wikified_body(body, title = nil) render_opts = {:locale => I18n.locale} # workaround for wikicloth 0.8.0 https://github.com/nricciar/wikicloth/pull/59 WikiCloth.new({:data => body+"\n", :link_handler => Wikilink.new, :params => {:referer => title}}).to_html(render_opts).html_safe + rescue + t('.wikicloth_exception').html_safe # try the following with line breaks: === one === == two == = three = end def link_to_wikipage(page, text = nil)