Adding textile definition

This commit is contained in:
Eston Bond
2010-11-03 15:00:20 -07:00
parent 649393eb6e
commit 8645927cbc
2 changed files with 121 additions and 5 deletions
+10 -5
View File
@@ -1,5 +1,10 @@
Create Common Layout
Create Basic CSS
Create View Page
Create History Page
Create Edit Page
Gollum Editor
- Style / Generate dialogs
- Dynamically show/hide different function bar buttons based on active language capabilities
- Def: Org
- Def: Pod
- Def: RDoc
- Def: Restructured Text
Make function bar button sprite
Roll scratch/ design into Mustache
+111
View File
@@ -0,0 +1,111 @@
/**
* Textile Language Definition
*/
(function() {
var Textile = {
'function-bold' : {
search: /([^\n]+)([\n]*)/gi,
replace: "*$1*$2"
},
'function-italic' : {
search: /([^\n]+)([\n]*)/gi,
replace: "_$1_$2"
},
'function-hr' : {
append: "\n***\n"
},
'function-code' : {
search: /([^\n]+)([\n]*)/gi,
replace: "<pre><code>$1</code></pre>$2"
},
'function-ul' : {
search: /(.+)([\n]?)/gi,
replace: "* $1$2"
},
/* This looks silly but is completely valid Markdown */
'function-ol' : {
search: /(.+)([\n]?)/gi,
replace: "# $1$2"
},
'function-blockquote' : {
search: /(.+)([\n]?)/gi,
replace: "bq. $1$2"
},
'function-link' : {
exec: function( txt, selText, $field ) {
var results = null;
$.GollumEditor.Dialog({
title: 'Insert Link',
fields: [
{
id: 'text',
name: 'Link Text',
type: 'text',
help: 'The text to display to the user.'
},
{
id: 'href',
name: 'URL',
type: 'text',
help: 'The URL to link to.'
}
],
OK: function( res ) {
if ( res['text'] && res['href'] ) {
return '"' + res['text'] + '":' +
res['href'];
}
else
return '';
}
});
}
},
'function-image' : {
exec: function( txt, selText, $field ) {
var results = null;
$.GollumEditor.Dialog.init({
title: 'Insert Image',
fields: [
{
id: 'url',
name: 'Image URL',
type: 'text'
},
{
id: 'alt',
name: 'Alt Text',
type: 'text'
}
],
OK: function( res ) {
if ( res['url'] ) {
var h = '!' + res['url'];
if ( res['alt'] != '' ) {
h += '(' + res['alt'] + ')';
}
h += '!';
return h;
}
}
});
}
}
};
jQuery.GollumEditor.defineLanguage('markdown', Textile);
})();