From 88dea1a06d833067e5a6d9668c4b6829e027a9f5 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 30 May 2008 16:35:36 +0000 Subject: [PATCH] Adds multi-levels blockquotes support by using > at the beginning of lines. Textile is preserved inside quoted text. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1479 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redcloth.rb | 25 +++++++++++ lib/redmine/wiki_formatting.rb | 2 +- public/images/jstoolbar/bt_bq.png | Bin 0 -> 503 bytes public/images/jstoolbar/bt_bq_remove.png | Bin 0 -> 501 bytes public/javascripts/jstoolbar/jstoolbar.js | 33 ++++++++++++++- .../jstoolbar/lang/jstoolbar-bg.js | 2 + .../jstoolbar/lang/jstoolbar-cs.js | 2 + .../jstoolbar/lang/jstoolbar-da.js | 2 + .../jstoolbar/lang/jstoolbar-de.js | 2 + .../jstoolbar/lang/jstoolbar-en.js | 2 + .../jstoolbar/lang/jstoolbar-es.js | 2 + .../jstoolbar/lang/jstoolbar-fi.js | 2 + .../jstoolbar/lang/jstoolbar-fr.js | 2 + .../jstoolbar/lang/jstoolbar-he.js | 2 + .../jstoolbar/lang/jstoolbar-hu.js | 2 + .../jstoolbar/lang/jstoolbar-it.js | 2 + .../jstoolbar/lang/jstoolbar-ja.js | 2 + .../jstoolbar/lang/jstoolbar-ko.js | 2 + .../jstoolbar/lang/jstoolbar-lt.js | 2 + .../jstoolbar/lang/jstoolbar-nl.js | 2 + .../jstoolbar/lang/jstoolbar-no.js | 2 + .../jstoolbar/lang/jstoolbar-pl.js | 2 + .../jstoolbar/lang/jstoolbar-pt-br.js | 2 + .../jstoolbar/lang/jstoolbar-pt.js | 2 + .../jstoolbar/lang/jstoolbar-ro.js | 2 + .../jstoolbar/lang/jstoolbar-ru.js | 2 + .../jstoolbar/lang/jstoolbar-sr.js | 2 + .../jstoolbar/lang/jstoolbar-sv.js | 2 + .../jstoolbar/lang/jstoolbar-th.js | 2 + .../jstoolbar/lang/jstoolbar-uk.js | 2 + .../jstoolbar/lang/jstoolbar-zh-tw.js | 2 + .../jstoolbar/lang/jstoolbar-zh.js | 2 + public/stylesheets/application.css | 2 + public/stylesheets/jstoolbar.css | 6 +++ test/unit/helpers/application_helper_test.rb | 40 ++++++++++++++++++ 35 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 public/images/jstoolbar/bt_bq.png create mode 100644 public/images/jstoolbar/bt_bq_remove.png diff --git a/lib/redcloth.rb b/lib/redcloth.rb index fb6a053c6..344fd6c78 100644 --- a/lib/redcloth.rb +++ b/lib/redcloth.rb @@ -299,6 +299,8 @@ class RedCloth < String hard_break text unless @lite_mode refs text + # need to do this before text is split by #blocks + block_textile_quotes text blocks text end inline text @@ -576,6 +578,29 @@ class RedCloth < String lines.join( "\n" ) end end + + QUOTES_RE = /(^>+([^\n]*?)\n?)+/m + QUOTES_CONTENT_RE = /^([> ]+)(.*)$/m + + def block_textile_quotes( text ) + text.gsub!( QUOTES_RE ) do |match| + lines = match.split( /\n/ ) + quotes = '' + indent = 0 + lines.each do |line| + line =~ QUOTES_CONTENT_RE + bq,content = $1, $2 + l = bq.count('>') + if l != indent + quotes << ("\n\n" + (l>indent ? '
' * (l-indent) : '
' * (indent-l)) + "\n\n") + indent = l + end + quotes << (content + "\n") + end + quotes << ("\n" + '' * indent + "\n\n") + quotes + end + end CODE_RE = /(\W) @ diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb index 3c1eac020..7197af2c3 100644 --- a/lib/redmine/wiki_formatting.rb +++ b/lib/redmine/wiki_formatting.rb @@ -45,7 +45,7 @@ module Redmine # Patch for RedCloth. Fixed in RedCloth r128 but _why hasn't released it yet. # http://code.whytheluckystiff.net/redcloth/changeset/128 def hard_break( text ) - text.gsub!( /(.)\n(?!\n|\Z| *([#*=]+(\s|$)|[{|]))/, "\\1
\n" ) if hard_breaks + text.gsub!( /(.)\n(?!\n|\Z|>| *(>? *[#*=]+(\s|$)|[{|]))/, "\\1
\n" ) if hard_breaks end # Patch to add code highlighting support to RedCloth diff --git a/public/images/jstoolbar/bt_bq.png b/public/images/jstoolbar/bt_bq.png new file mode 100644 index 0000000000000000000000000000000000000000..c3af4e07f65847c109006a911359565dd88f7a12 GIT binary patch literal 503 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!Zi#C|iE~kEVo7FxoWhEpegoTCq`T0FPJ)NDMZEbDM&CLxB4YjqkRaI5x<>jTMq(ntU1qB6p zczCK-zqGTnv#_u*GBVQ9(NR)TYTocVf8pc1&%P%nCdS0XgoT9#1_t{0_;`4DG;Mr7 zZO_||%`eK9KEC(t`;=X88`eL6@bX7+aImkhualFLjg5_&nVErs!R&n>3JMCcv$NCE z(!#^TgMxxeOG}H3i}UmI)6>(Fl9FO$V_!@p zljrH;7*cU7IYEIbA}VtBtsA#)M!&GMcodMtb3|=f+9$4OVgii1xw34rwxYGn&dLJe zp`pI9&cd$UJ!@o|_cSe%y{W;-5;PJOS+@4BLl<6e(pbstU&(Z0G|-o|NsA6TU(o$nCR*0 zX=rFDD=W*&%1TH`2n!4I^YeRpdOABh+uGWio0}UN8ft56tE#HX%gakiNr{Sz3JMDH z@bHwZcxh*6XJKJsWMrhHqobsx^x)->qGgY3*S<+9s?WMgAvW@ct!U@(2phk}BF?Ck8cw6yT> z@Svce($do6;^O@L{Pgtnq@<+S*w~1O2zPgPM@Pp~?MEws-eD{W@(X5gcy=QV$jSF~ zaSW-rm7Ji!77-COGvfA*TQgtZvVIVd#B$`A+OkhvY0nhaP20vc;mXC(iy*<1(dTdVI-qJn0eR_YqLx4wwi^y&+H?=ge iFtai~zeRsqIT $2"); + }); + } + } +} + +// unbq +jsToolBar.prototype.elements.unbq = { + type: 'button', + title: 'Unquote', + fn: { + wiki: function() { + this.encloseLineSelection('','',function(str) { + str = str.replace(/\r/g,''); + return str.replace(/(\n|^) *[>]? *([^\n]*)/g,"$1$2"); + }); + } + } +} + // pre jsToolBar.prototype.elements.pre = { type: 'button', @@ -508,7 +539,7 @@ jsToolBar.prototype.elements.pre = { } // spacer -jsToolBar.prototype.elements.space3 = {type: 'space'} +jsToolBar.prototype.elements.space4 = {type: 'space'} // wiki page jsToolBar.prototype.elements.link = { diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-bg.js b/public/javascripts/jstoolbar/lang/jstoolbar-bg.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-bg.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-bg.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-cs.js b/public/javascripts/jstoolbar/lang/jstoolbar-cs.js index 8a59a8162..f2c0dbff5 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-cs.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-cs.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Záhlaví 2'; jsToolBar.strings['Heading 3'] = 'Záhlaví 3'; jsToolBar.strings['Unordered list'] = 'Seznam'; jsToolBar.strings['Ordered list'] = 'Uspořádaný seznam'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Předformátovaný text'; jsToolBar.strings['Wiki link'] = 'Vložit odkaz na Wiki stránku'; jsToolBar.strings['Image'] = 'Vložit obrázek'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-da.js b/public/javascripts/jstoolbar/lang/jstoolbar-da.js index 9996acaf3..6ccc8ead2 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-da.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-da.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Overskrift 2'; jsToolBar.strings['Heading 3'] = 'Overskrift 3'; jsToolBar.strings['Unordered list'] = 'Unummereret list'; jsToolBar.strings['Ordered list'] = 'Nummereret list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatteret tekst'; jsToolBar.strings['Wiki link'] = 'Link til en Wiki side'; jsToolBar.strings['Image'] = 'Billede'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-de.js b/public/javascripts/jstoolbar/lang/jstoolbar-de.js index e2ba3fc1c..ce686860f 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-de.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-de.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Überschrift 2. Ordnung'; jsToolBar.strings['Heading 3'] = 'Überschrift 3. Ordnung'; jsToolBar.strings['Unordered list'] = 'Aufzählungsliste'; jsToolBar.strings['Ordered list'] = 'Nummerierte Liste'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Präformatierter Text'; jsToolBar.strings['Wiki link'] = 'Verweis (Link) zu einer Wiki-Seite'; jsToolBar.strings['Image'] = 'Grafik'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-en.js b/public/javascripts/jstoolbar/lang/jstoolbar-en.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-en.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-en.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-es.js b/public/javascripts/jstoolbar/lang/jstoolbar-es.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-es.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-es.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-fi.js b/public/javascripts/jstoolbar/lang/jstoolbar-fi.js index 357d25951..c2229b281 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-fi.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-fi.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Otsikko 2'; jsToolBar.strings['Heading 3'] = 'Otsikko 3'; jsToolBar.strings['Unordered list'] = 'Järjestämätön lista'; jsToolBar.strings['Ordered list'] = 'Järjestetty lista'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Ennaltamuotoiltu teksti'; jsToolBar.strings['Wiki link'] = 'Linkki Wiki sivulle'; jsToolBar.strings['Image'] = 'Kuva'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-fr.js b/public/javascripts/jstoolbar/lang/jstoolbar-fr.js index 3cbc67863..c52a783bc 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-fr.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-fr.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Titre niveau 2'; jsToolBar.strings['Heading 3'] = 'Titre niveau 3'; jsToolBar.strings['Unordered list'] = 'Liste à puces'; jsToolBar.strings['Ordered list'] = 'Liste numérotée'; +jsToolBar.strings['Quote'] = 'Citer'; +jsToolBar.strings['Unquote'] = 'Supprimer citation'; jsToolBar.strings['Preformatted text'] = 'Texte préformaté'; jsToolBar.strings['Wiki link'] = 'Lien vers une page Wiki'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-he.js b/public/javascripts/jstoolbar/lang/jstoolbar-he.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-he.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-he.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-hu.js b/public/javascripts/jstoolbar/lang/jstoolbar-hu.js index e586a123b..c31ba00c0 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-hu.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-hu.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Fejléc 2'; jsToolBar.strings['Heading 3'] = 'Fejléc 3'; jsToolBar.strings['Unordered list'] = 'Felsorolás'; jsToolBar.strings['Ordered list'] = 'Számozott lista'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Előreformázott szöveg'; jsToolBar.strings['Wiki link'] = 'Link egy Wiki oldalra'; jsToolBar.strings['Image'] = 'Kép'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-it.js b/public/javascripts/jstoolbar/lang/jstoolbar-it.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-it.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-it.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-ja.js b/public/javascripts/jstoolbar/lang/jstoolbar-ja.js index fc4d987de..c9413dac2 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-ja.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-ja.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = '見出し 2'; jsToolBar.strings['Heading 3'] = '見出し 3'; jsToolBar.strings['Unordered list'] = '順不同リスト'; jsToolBar.strings['Ordered list'] = '番号つきリスト'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = '整形済みテキスト'; jsToolBar.strings['Wiki link'] = 'Wiki ページへのリンク'; jsToolBar.strings['Image'] = '画像'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-ko.js b/public/javascripts/jstoolbar/lang/jstoolbar-ko.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-ko.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-ko.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-lt.js b/public/javascripts/jstoolbar/lang/jstoolbar-lt.js index f0a7c5d90..8af364c8d 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-lt.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-lt.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Nenumeruotas sąrašas'; jsToolBar.strings['Ordered list'] = 'Numeruotas sąrašas'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatuotas tekstas'; jsToolBar.strings['Wiki link'] = 'Nuoroda į Wiki puslapį'; jsToolBar.strings['Image'] = 'Paveikslas'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-nl.js b/public/javascripts/jstoolbar/lang/jstoolbar-nl.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-nl.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-nl.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-no.js b/public/javascripts/jstoolbar/lang/jstoolbar-no.js index cf6e19ff9..2fb098a9d 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-no.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-no.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Overskrift 2'; jsToolBar.strings['Heading 3'] = 'Overskrift 3'; jsToolBar.strings['Unordered list'] = 'Punktliste'; jsToolBar.strings['Ordered list'] = 'Nummerert liste'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatert tekst'; jsToolBar.strings['Wiki link'] = 'Lenke til Wiki-side'; jsToolBar.strings['Image'] = 'Bilde'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-pl.js b/public/javascripts/jstoolbar/lang/jstoolbar-pl.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-pl.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-pl.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-pt-br.js b/public/javascripts/jstoolbar/lang/jstoolbar-pt-br.js index 8fc58ba67..5035524ab 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-pt-br.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-pt-br.js @@ -11,6 +11,8 @@ jsToolBar.strings['Heading 2'] = 'Cabeçalho 2'; jsToolBar.strings['Heading 3'] = 'Cabeçalho 3'; jsToolBar.strings['Unordered list'] = 'Lista não ordenada'; jsToolBar.strings['Ordered list'] = 'Lista ordenada'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Texto pré-formatado'; jsToolBar.strings['Wiki link'] = 'Link para uma página Wiki'; jsToolBar.strings['Image'] = 'Imagem'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-pt.js b/public/javascripts/jstoolbar/lang/jstoolbar-pt.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-pt.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-pt.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-ro.js b/public/javascripts/jstoolbar/lang/jstoolbar-ro.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-ro.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-ro.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-ru.js b/public/javascripts/jstoolbar/lang/jstoolbar-ru.js index 6370a3e2d..a6d8c4fad 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-ru.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-ru.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Заголовок 2'; jsToolBar.strings['Heading 3'] = 'Заголовок 3'; jsToolBar.strings['Unordered list'] = 'Маркированный список'; jsToolBar.strings['Ordered list'] = 'Нумерованный список'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Заранее форматированный текст'; jsToolBar.strings['Wiki link'] = 'Ссылка на страницу в Wiki'; jsToolBar.strings['Image'] = 'Вставка изображения'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-sr.js b/public/javascripts/jstoolbar/lang/jstoolbar-sr.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-sr.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-sr.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-sv.js b/public/javascripts/jstoolbar/lang/jstoolbar-sv.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-sv.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-sv.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-th.js b/public/javascripts/jstoolbar/lang/jstoolbar-th.js index 2e2f2b88e..d87164226 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-th.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-th.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'หัวข้อ 2'; jsToolBar.strings['Heading 3'] = 'หัวข้อ 3'; jsToolBar.strings['Unordered list'] = 'รายการ'; jsToolBar.strings['Ordered list'] = 'ลำดับเลข'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'รูปแบบข้อความคงที่'; jsToolBar.strings['Wiki link'] = 'เชื่อมโยงไปหน้า Wiki อื่น'; jsToolBar.strings['Image'] = 'รูปภาพ'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-uk.js b/public/javascripts/jstoolbar/lang/jstoolbar-uk.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-uk.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-uk.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-zh-tw.js b/public/javascripts/jstoolbar/lang/jstoolbar-zh-tw.js index 1e46e2470..a87ad3442 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-zh-tw.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-zh-tw.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = '標題 2'; jsToolBar.strings['Heading 3'] = '標題 3'; jsToolBar.strings['Unordered list'] = '項目清單'; jsToolBar.strings['Ordered list'] = '編號清單'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = '格式化文字'; jsToolBar.strings['Wiki link'] = '連結至 Wiki 頁面'; jsToolBar.strings['Image'] = '圖片'; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-zh.js b/public/javascripts/jstoolbar/lang/jstoolbar-zh.js index cd36a4b55..2d68498f9 100644 --- a/public/javascripts/jstoolbar/lang/jstoolbar-zh.js +++ b/public/javascripts/jstoolbar/lang/jstoolbar-zh.js @@ -9,6 +9,8 @@ jsToolBar.strings['Heading 2'] = 'Heading 2'; jsToolBar.strings['Heading 3'] = 'Heading 3'; jsToolBar.strings['Unordered list'] = 'Unordered list'; jsToolBar.strings['Ordered list'] = 'Ordered list'; +jsToolBar.strings['Quote'] = 'Quote'; +jsToolBar.strings['Unquote'] = 'Remove Quote'; jsToolBar.strings['Preformatted text'] = 'Preformatted text'; jsToolBar.strings['Wiki link'] = 'Link to a Wiki page'; jsToolBar.strings['Image'] = 'Image'; diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 4ae1c70f1..f51d1841c 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -153,6 +153,8 @@ input, select {vertical-align: middle; margin-top: 1px; margin-bottom: 1px;} fieldset {border: 1px solid #e4e4e4; margin:0;} legend {color: #484848;} hr { width: 100%; height: 1px; background: #ccc; border: 0;} +blockquote { font-style: italic; border-left: 3px solid #e0e0e0; padding-left: 0.6em; margin-left: 2.4em;} +blockquote blockquote { margin-left: 0;} textarea.wiki-edit { width: 99%; } li p {margin-top: 0;} div.issue {background:#ffffdd; padding:6px; margin-bottom:6px;border: 1px solid #d7d7d7;} diff --git a/public/stylesheets/jstoolbar.css b/public/stylesheets/jstoolbar.css index c4ab55711..4e9d44b6c 100644 --- a/public/stylesheets/jstoolbar.css +++ b/public/stylesheets/jstoolbar.css @@ -84,6 +84,12 @@ .jstb_ol { background-image: url(../images/jstoolbar/bt_ol.png); } +.jstb_bq { + background-image: url(../images/jstoolbar/bt_bq.png); +} +.jstb_unbq { + background-image: url(../images/jstoolbar/bt_bq_remove.png); +} .jstb_pre { background-image: url(../images/jstoolbar/bt_pre.png); } diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index ffee28b00..f8bf4a602 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -178,6 +178,46 @@ class ApplicationHelperTest < HelperTestCase assert_equal '

Dashes: ---

', textilizable('Dashes: ---') end + def test_blockquote + # orig raw text + raw = <<-RAW +John said: +> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero. +> Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor. +> * Donec odio lorem, +> * sagittis ac, +> * malesuada in, +> * adipiscing eu, dolor. +> +> >Nulla varius pulvinar diam. Proin id arcu id lorem scelerisque condimentum. Proin vehicula turpis vitae lacus. +> Proin a tellus. Nam vel neque. + +He's right. +RAW + + # expected html + expected = <<-EXPECTED +

John said:

+
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero. +Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor. +
    +
  • Donec odio lorem,
  • +
  • sagittis ac,
  • +
  • malesuada in,
  • +
  • adipiscing eu, dolor.
  • +
+
+

Nulla varius pulvinar diam. Proin id arcu id lorem scelerisque condimentum. Proin vehicula turpis vitae lacus.

+
+

Proin a tellus. Nam vel neque.

+
+

He's right.

+EXPECTED + + assert_equal expected.gsub(%r{\s+}, ''), textilizable(raw).gsub(%r{\s+}, '') + end + def test_macro_hello_world text = "{{hello_world}}" assert textilizable(text).match(/Hello world!/) -- 2.39.5