diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-12-23 13:05:10 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-12-23 13:05:10 +0000 |
commit | 471e01ca5059f892888f78e2278dd41d742a4b75 (patch) | |
tree | a07ecd3d8911cf0e6ce1220584fa2c10ed81b9ab /lib/redmine/wiki_formatting/markdown/helper.rb | |
parent | 6311ade82708b63b83d30278a1af4c05af4aee6e (diff) | |
download | redmine-471e01ca5059f892888f78e2278dd41d742a4b75.tar.gz redmine-471e01ca5059f892888f78e2278dd41d742a4b75.zip |
Adds experimental support for Markdown formatting with redcarpet (#15520).
git-svn-id: http://svn.redmine.org/redmine/trunk@12452 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/wiki_formatting/markdown/helper.rb')
-rw-r--r-- | lib/redmine/wiki_formatting/markdown/helper.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/redmine/wiki_formatting/markdown/helper.rb b/lib/redmine/wiki_formatting/markdown/helper.rb new file mode 100644 index 000000000..2619cb71e --- /dev/null +++ b/lib/redmine/wiki_formatting/markdown/helper.rb @@ -0,0 +1,45 @@ +# Redmine - project management software +# Copyright (C) 2006-2013 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +module Redmine + module WikiFormatting + module Markdown + module Helper + def wikitoolbar_for(field_id) + heads_for_wiki_formatter + javascript_tag("var wikiToolbar = new jsToolBar(document.getElementById('#{field_id}')); wikiToolbar.draw();") + end + + def initial_page_content(page) + "# #{@page.pretty_title}" + end + + def heads_for_wiki_formatter + unless @heads_for_wiki_formatter_included + content_for :header_tags do + javascript_include_tag('jstoolbar/jstoolbar') + + javascript_include_tag('jstoolbar/markdown') + + javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language.to_s.downcase}") + + stylesheet_link_tag('jstoolbar') + end + @heads_for_wiki_formatter_included = true + end + end + end + end + end +end |