/** * Org-mode Language Definition **/ (function() { var OrgMode = { 'function-bold' : { search: /([^\n]+)([\n\s]*)/g, replace: "*$1*$2" }, 'function-italic' : { search: /([^\n]+)([\n\s]*)/g, replace: "/$1/$2" }, 'function-code' : { search: /(^[\n]+)([\n\s]*)/g, replace: "=$1=$2" }, 'function-ul' : { search: /(.+)([\n]?)/g, replace: "* $1$2" }, /* This works, just like it works for Markdown */ 'function-ol' : { search: /(.+)([\n]?)/g, replace: "1. $1$2" }, 'function-blockquote' : { search: /(.+)([\n]?)/g, replace: "#+BEGIN_QUOTE\n$1$2\n#+END_QUOTE\n" }, 'function-h1' : { search: /(.+)([\n]?)/g, replace: "* $1$2" }, 'function-h2' : { search: /(.+)([\n]?)/g, replace: "** $1$2" }, 'function-h3' : { search: /(.+)([\n]?)/g, replace: "*** $1$2" }, 'function-link' : { exec: function( txt, selText, $field ) { var results = null; $.GollumEditor.Dialog.init({ title: 'Insert Link', fields: [ { id: 'text', name: 'Link Text', type: 'text' }, { id: 'href', name: 'URL', type: 'text' } ], OK: function( res ) { var rep = ''; if ( res['text'] && res['href'] ) { rep = '[[' + res['href'] + '][' + res['text'] + ']]'; } else if ( res['href'] ) { rep = '[[' + res['href'] + ']]'; } $.GollumEditor.replaceSelection( rep ); } }); } }, 'function-image' : { exec: function( txt, selText, $field ) { var results = null; $.GollumEditor.Dialog.init({ title: 'Insert Image', fields: [ { id: 'url', name: 'Image URL', type: 'text' }, ], OK: function( res ) { var rep = ''; if ( res['url'] ) { rep = '[[' + res['url'] + ']]'; } $.GollumEditor.replaceSelection( rep ); } }); } } }; var OrgModeHelp = [ { menuName: 'Block Elements', content: [ { menuName: 'Paragraphs & Breaks', data: '

To create a paragraph, simply create a block of text that is not separated by one or more blank lines. Blocks of text separated by one or more blank lines will be parsed as paragraphs.

' }, { menuName: 'Headers', data: '

Simply prefix your header text with the number of * characters to specify heading depth. For example: * Header 1, ** Header 2 and *** Header 3 will be progressively smaller headers.

' }, { menuName: 'Blockquotes', data: '

To create a blockquote, simple embed the text between #+BEGIN_QUOTE and #+END_QUOTE. An example quote block is displayed below:
#+BEGIN_QUOTE
This is my quote block. Quote something nice here, otherwise there is no point in quoting.
#+END_QUOTE

' }, { menuName: 'Lists', data: '

Org-mode supports both ordered and unordered lists. To create an ordered list, simply prefix each line with a number (any number will do — this is why the editor only uses one number.) To create an unordered list, you can prefix each line with + or -.

' }, { menuName: 'Code Blocks', data: '

Code Blocks are similar to blockquote, except that #+BEGIN_EXAMPLE and #+END_EXAMPLE are used.

' }, { menuName: 'Tables', data: '

Org-mode supports simple tables (tables with equal number of cells in each row). To create a simple table, just separate the contents of each cell with a | character. For example,

|one|two|three|
|four|five|six|


will appear as a table with two rows and three columns. Additionally,

|one|two|three|
|---+---+-----|
|four|five|six|


will also appear as a table, but the first row will be interpreted as a header row and the <th> tag will be used to render it.

' }, ] }, { menuName: 'Span Elements', content: [ { menuName: 'Links', data: '

To create links to external pages, you need to enclose the URI in double square brackets. (i.e., [[http://github.com/]] will automatically be parsed to http://github.com/)If you want to add text, to be displayed to the user, you write the URI and the text next to each other, both enclosed in square brackets and both of them together enclosed in another pair of square brackets. For example, if you want your link to display the text “GitHub”, you write [[http://github.com][GitHub]].

' }, { menuName: 'Emphasis', data: '

Forward slashes (/) are treated as emphasis and are wrapped with an <i> tag. Asterisks (*) are treated as bold using the <b> tag.

' }, { menuName: 'Code', data: '

To create inline spans of code, simply wrap the code in equal signs (=). Orgmode will turn =myFunction= into myFunction.

' }, { menuName: 'Images', data: "

Org-mode image syntax is exactly same as the syntax that you would use for a URI to link to itself. The image URI is enclosed in double square brackets. Alt text on images is not currently supported by Gollum's Org-mode parser.

" } ] }, ]; jQuery.GollumEditor.defineLanguage('org', OrgMode); jQuery.GollumEditor.defineHelp('org', OrgModeHelp); })();