From e58ad1d4dea4eff81d70ab7e4bccdbe3a3e046b0 Mon Sep 17 00:00:00 2001 From: ado Date: Wed, 28 Mar 2012 10:36:44 +0530 Subject: [PATCH 1/2] [FIX] Wiki module - several text formating issues bzr revid: ado@tinyerp.com-20120328050644-e2244yd1bt7sla3c --- addons/wiki/static/src/lib/wiky/wiky.js | 26 ++++++++++++++++--------- addons/wiki/wiki.py | 4 ++-- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/addons/wiki/static/src/lib/wiky/wiky.js b/addons/wiki/static/src/lib/wiky/wiky.js index 5bc9c6f167d..9fecb98ec19 100755 --- a/addons/wiki/static/src/lib/wiky/wiky.js +++ b/addons/wiki/static/src/lib/wiky/wiky.js @@ -11,17 +11,20 @@ wiky.process = function(wikitext) { var lines = wikitext.split(/\r?\n/); var start; var html = ""; - for (var i=0;i"; + html += "

"+line.substring(3,line.length-3)+"

"; } else if (line.match(/^==/)!=null && line.match(/==$/)!=null) { - html += "

"+line.substring(2,line.length-2)+"

"; + html += "

"+line.substring(2,line.length-2)+"

"; + } + else if (line.match(/^=/)!=null && line.match(/=$/)!=null) + { + html += "

"+line.substring(1,line.length-1)+"

"; } else if (line.match(/^:+/)!=null) { @@ -54,6 +57,14 @@ wiky.process = function(wikitext) { html += wiky.process_bullet_point(lines,start,i); } + else if (line.match(/^img/)!=null) + { + html += wiky.process_image(line); + } + else if (line.match(/^attach/)!=null) + { + html += "Download the file" + } else { html += wiky.process_normal(line); @@ -61,7 +72,6 @@ wiky.process = function(wikitext) { html += "
\n"; } - return html; }; @@ -197,12 +207,10 @@ wiky.process_image = function(txt) { if (index > -1) { - url = txt.substring(0,index); - label = txt.substring(index+1); + label = txt.substring(0,index); + url = txt.substring(index+1); } - - - return "\""+label+"\""; + return "\""+label+"\""; }; wiky.process_video = function(url) { diff --git a/addons/wiki/wiki.py b/addons/wiki/wiki.py index fa1dca8e95a..3b370ddc06b 100644 --- a/addons/wiki/wiki.py +++ b/addons/wiki/wiki.py @@ -230,9 +230,9 @@ class wiki_history(osv.osv): text2 = history_pool.read(cr, uid, [v2], ['text_area'])[0]['text_area'] line1 = line2 = '' if text1: - line1 = tools.ustr(text1.splitlines(1)) + line1 = text1.splitlines(1) if text2: - line2=tools.ustr(text2.splitlines(1)) + line2 = text2.splitlines(1) if (not line1 and not line2) or (line1 == line2): raise osv.except_osv(_('Warning !'), _('There are no changes in revisions')) diff = difflib.HtmlDiff() From 2b619bd2a731496f1b5444c5192790970c7f7714 Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Fri, 27 Apr 2012 12:53:27 +0200 Subject: [PATCH 2/2] [FIX] wiki: fix external image link bzr revid: xal@openerp.com-20120427105327-sj7pqq4qs73i8kvl --- addons/wiki/static/src/lib/wiky/wiky.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/wiki/static/src/lib/wiky/wiky.js b/addons/wiki/static/src/lib/wiky/wiky.js index 1e331ef4229..f4d3fd3c89d 100755 --- a/addons/wiki/static/src/lib/wiky/wiky.js +++ b/addons/wiki/static/src/lib/wiky/wiky.js @@ -57,11 +57,11 @@ wiky.process = function(wikitext) { html += wiky.process_bullet_point(lines,start,i); } - else if (line.match(/^img/)!=null) + else if (line.match(/^img:/)!=null) { - html += wiky.process_image(line); + html += wiky.process_image(line.substring(4)); } - else if (line.match(/^attach/)!=null) + else if (line.match(/^attach:/)!=null) { html += "Download the file" } @@ -107,7 +107,6 @@ wiky.process_indent = function(lines,start,end) { wiky.process_bullet_point = function(lines,start,end) { var html = (lines[start].charAt(0)=='*')?"
    ":"
      "; - for(var i=start;i<=end;i++) { html += "
    1. "; @@ -210,7 +209,7 @@ wiky.process_image = function(txt) { label = txt.substring(0,index); url = txt.substring(index+1); } - return "\""+label+"\""; + return "\""+label+"\""; }; wiky.process_video = function(url) {