Merge pull request #230 from foodcoop-rostock/workaround-possible-wikicloth-bug

Rescue on WikiCloth exception
This commit is contained in:
wvengen 2013-12-23 01:51:27 -08:00
commit d7f624a089
3 changed files with 4 additions and 0 deletions

View file

@ -1167,6 +1167,7 @@ de:
title_list: Seiten-Liste
body:
title_toc: Inhalt
wikicloth_exception: "Entschuldigung, ein Fehler ist beim Anzeigen der Wikiseite aufgetreten: »%{msg}«. Bearbeiten der Seite kann helfen, diesen Fehler zu beseitigen."
create:
notice: Seite wurde angelegt
cshow:

View file

@ -1171,6 +1171,7 @@ en:
title_list: List of pages
body:
title_toc: Content
wikicloth_exception: "I'm sorry to report that an error occured when interpreting the wiki page: %{msg}. Please try to fix it, and save the page again."
create:
notice: Page was created
cshow:

View file

@ -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 => e
"<span class='alert alert-error'>#{t('.wikicloth_exception', :msg => e)}</span>".html_safe # try the following with line breaks: === one === == two == = three =
end
def link_to_wikipage(page, text = nil)