From d493deead64ba76da6d8a295d619644167b01477 Mon Sep 17 00:00:00 2001 From: Bret McMillan Date: Mon, 17 Nov 2008 14:16:41 -0500 Subject: dos2unix fixes --- .../tiny_mce/plugins/mediawiki/editor_plugin.js | 248 ++++++++++----------- 1 file changed, 124 insertions(+), 124 deletions(-) (limited to 'extensions/tinymce') diff --git a/extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/editor_plugin.js b/extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/editor_plugin.js index 8767200..47f2770 100644 --- a/extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/editor_plugin.js +++ b/extensions/tinymce/jscripts/tiny_mce/plugins/mediawiki/editor_plugin.js @@ -1,125 +1,125 @@ -/** - * $Id$ - * - * @author Bret McMillan - * @copyright Copyright © 2004-2008, Red Hat, Inc., All rights reserved. - * - * Adapted from: - * - the "example" and "bbcode" plugins provided by Moxicode - * - Remy Sharp's wiki2html code: http://remysharp.com/2008/04/01/wiki-to-html-using-javascript/ - * - * See also: http://en.wikipedia.org/wiki/Wikipedia:Cheatsheet - */ - -(function() { - tinymce.create('tinymce.plugins.MediaWikiPlugin', { - /** - * Initializes the plugin, this will be executed after the plugin has been created. - * This call is done before the editor instance has finished it's initialization so use the onInit event - * of the editor instance to intercept that event. - * - * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. - * @param {string} url Absolute URL to where the plugin is located. - */ - init : function(ed, url) { - var t = this; - // load wiki2html syncronous calls... - // might want to explore async later - tinymce.ScriptLoader.load(tinymce.PluginManager.urls.mediawiki + '/wiki2html.js'); - - ed.onBeforeSetContent.add(function(ed, o) { - o.content = t['_mw2html'](o.content); - }); - - ed.onPostProcess.add(function(ed, o) { - if (o.set) - o.content = t['_mw2html'](o.content); - - if (o.get) - o.content = t['_html2mw'](o.content); - - }); - }, - - /** - * Returns information about the plugin as a name/value array. - * The current keys are longname, author, authorurl, infourl and version. - * - * @return {Object} Name/value array containing information about the plugin. - */ - getInfo : function() { - return { - longname : 'MediaWiki plugin', - author : 'Bret McMillan ', - authorurl : 'http://www.redhat.com/', - infourl : 'http://www.redhat.com/', - version : "0.1" - }; - }, - - // Private methods - - // HTML -> MediaWiki, it'd be nice to get this upstream into remy's code - _html2mw : function(s) { - // s = tinymce.trim(s); - - function rep(re, str) { - s = s.replace(re, str); - }; - - // WikiWord urls - rep(/\1<\/a>/gim, "[[$1]]"); - - // handle where url's text is the same as the url - rep(/\1<\/a>/gim, "$1"); - - - // handle external urls with body text - rep(/(.+?)<\/a>/gim,"[$1 $2]"); - - // to '' - rep(/(.*?)<\/em>/gim, "''$1''"); - - // to ''' - rep(/(.*?)<\/strong>/gim, "'''$1'''"); - - // headers - rep(/

(.*?)<\/h1>/gim, "\n=$1="); - rep(/

(.*?)<\/h2>/gim, "\n==$1=="); - rep(/

(.*?)<\/h3>/gim, "\n===$1==="); - rep(/

(.*?)<\/h4>/gim, "\n====$1===="); - rep(/

(.*?)<\/h5>/gim, "\n=====$1====="); - rep(/
(.*?)<\/h6>/gim, "\n======$1======"); - - //

- rep(/

([\s\S]*?)<\/p>/gim, '\n\n$1'); - - //
- rep(/]*>/gim, '\n\n'); - - // - //rep(/ /gi, ' '); - - // ul,ol lists - // XXXXXXXXXXXXXXXXXXXXXX - - - // images - // XXXXXXXXXXXXXXXXXXXXXX - - // tables - // XXXXXXXXXXXXXXXXXXXXXX - - return s; - }, - - // MediaWiki -> HTML, delegate to remy's code - _mw2html : function(s) { - //s = tinymce.trim(s); - return s.wiki2html(); - } - }); - - // Register plugin - tinymce.PluginManager.add('mediawiki', tinymce.plugins.MediaWikiPlugin); +/** + * $Id$ + * + * @author Bret McMillan + * @copyright Copyright © 2004-2008, Red Hat, Inc., All rights reserved. + * + * Adapted from: + * - the "example" and "bbcode" plugins provided by Moxicode + * - Remy Sharp's wiki2html code: http://remysharp.com/2008/04/01/wiki-to-html-using-javascript/ + * + * See also: http://en.wikipedia.org/wiki/Wikipedia:Cheatsheet + */ + +(function() { + tinymce.create('tinymce.plugins.MediaWikiPlugin', { + /** + * Initializes the plugin, this will be executed after the plugin has been created. + * This call is done before the editor instance has finished it's initialization so use the onInit event + * of the editor instance to intercept that event. + * + * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. + * @param {string} url Absolute URL to where the plugin is located. + */ + init : function(ed, url) { + var t = this; + // load wiki2html syncronous calls... + // might want to explore async later + tinymce.ScriptLoader.load(tinymce.PluginManager.urls.mediawiki + '/wiki2html.js'); + + ed.onBeforeSetContent.add(function(ed, o) { + o.content = t['_mw2html'](o.content); + }); + + ed.onPostProcess.add(function(ed, o) { + if (o.set) + o.content = t['_mw2html'](o.content); + + if (o.get) + o.content = t['_html2mw'](o.content); + + }); + }, + + /** + * Returns information about the plugin as a name/value array. + * The current keys are longname, author, authorurl, infourl and version. + * + * @return {Object} Name/value array containing information about the plugin. + */ + getInfo : function() { + return { + longname : 'MediaWiki plugin', + author : 'Bret McMillan ', + authorurl : 'http://www.redhat.com/', + infourl : 'http://www.redhat.com/', + version : "0.1" + }; + }, + + // Private methods + + // HTML -> MediaWiki, it'd be nice to get this upstream into remy's code + _html2mw : function(s) { + // s = tinymce.trim(s); + + function rep(re, str) { + s = s.replace(re, str); + }; + + // WikiWord urls + rep(/\1<\/a>/gim, "[[$1]]"); + + // handle where url's text is the same as the url + rep(/\1<\/a>/gim, "$1"); + + + // handle external urls with body text + rep(/(.+?)<\/a>/gim,"[$1 $2]"); + + // to '' + rep(/(.*?)<\/em>/gim, "''$1''"); + + // to ''' + rep(/(.*?)<\/strong>/gim, "'''$1'''"); + + // headers + rep(/

(.*?)<\/h1>/gim, "\n=$1="); + rep(/

(.*?)<\/h2>/gim, "\n==$1=="); + rep(/

(.*?)<\/h3>/gim, "\n===$1==="); + rep(/

(.*?)<\/h4>/gim, "\n====$1===="); + rep(/

(.*?)<\/h5>/gim, "\n=====$1====="); + rep(/
(.*?)<\/h6>/gim, "\n======$1======"); + + //

+ rep(/

([\s\S]*?)<\/p>/gim, '\n\n$1'); + + //
+ rep(/]*>/gim, '\n\n'); + + // + //rep(/ /gi, ' '); + + // ul,ol lists + // XXXXXXXXXXXXXXXXXXXXXX + + + // images + // XXXXXXXXXXXXXXXXXXXXXX + + // tables + // XXXXXXXXXXXXXXXXXXXXXX + + return s; + }, + + // MediaWiki -> HTML, delegate to remy's code + _mw2html : function(s) { + //s = tinymce.trim(s); + return s.wiki2html(); + } + }); + + // Register plugin + tinymce.PluginManager.add('mediawiki', tinymce.plugins.MediaWikiPlugin); })(); \ No newline at end of file -- cgit