/** * Textile Language Definition */ (function($) { var Textile = { 'function-bold' : { search: /(^[\n]+)([\n\s]*)/g, replace: "*$1*$2" }, 'function-italic' : { search: /(^[\n]+)([\n\s]*)/g, replace: "_$1_$2" }, 'function-hr' : { append: "\n***\n" }, 'function-code' : { search: /(^[\n]+)([\n\s]*)/g, replace: "
$1
$2" }, 'function-ul' : { search: /(.+)([\n]?)/gi, replace: "* $1$2" }, '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.init({ 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 ) { var h = ''; if ( res['text'] && res['href'] ) { h = '"' + res['text'] + '":' + res['href']; } $.GollumEditor.replaceSelection( h ); } }); } }, '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 += '!'; $.GollumEditor.replaceSelection( h ); } } }); } } }; $.GollumEditor.defineLanguage('textile', Textile); var TextileHelp = [ { menuName: 'Phrase Modifiers', content: [ { menuName: 'Emphasis / Strength', data: '

To place emphasis or strength on inline text, simply place _ (underscores) around the text for emphasis or * (asterisks) around the text for strength. In most browsers, _mytext_ will appear as italics and *mytext* will appear as bold.

To force italics or bold, simply double the characters: __mytext__ will appear italic and **mytext** will appear as bold text.

' }, { menuName: 'Citations / Editing', data: '

To display citations, wrap your text in ?? (two question marks).

To display edit marks such as deleted text (strikethrough) or inserted text (underlined text), wrap your text in - (minuses) or + (pluses). For example -mytext- will be rendered as mytext and +mytext+ will be rendered as mytext

' }, { menuName: 'Superscript / Subscript', data: '

To display superscript, wrap your text in ^ (carets). To display subscript, wrap your text in ~ (tildes).

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

To display monospace code, wrap your text in @ (at symbol). For example, @mytext@ will appear as mytext.

' }, { menuName: 'Acronyms', data: '

To create an acronym, suffix the acronym with the definition in parentheses. For example, JS(JavaScript) will be displayed as JS.

' } ] }, { menuName: 'Block Modifiers', content: [ { menuName: 'Headings', data: '

To display a heading in Textile, prefix your line of text with hn., where n equals the heading size you want (1 is largest, 6 is smallest).

' }, { menuName: 'Paragraphs / Quotes', data: '

To create a new paragraph, prefix your first line of a block of text with p..

To create a blockquote, make sure at least one blank line exists between your text and any surrounding text, and then prefix that block with bq. If you need to extend a blockquote to more than one text block, write bq.. (note the two periods) and prefix your next normal paragraph with p.

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

Code blocks in textile are simply prefixed like any other block. To create a code block, place the beginning of the block on a separate line and prefix it with bc.

To display a preformatted block, prefix the block with pre.

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

To create ordered lists, prefix each line with #. To create unordered lists, prefix each line with *.

' } ] }, { menuName: 'Links / Images', content: [ { menuName: 'Links', data: '

To display a link, put the text you want to display in quotes, then a colon (:), then the URL after the colon. For example "GitHub":http://github.com/ will appear as GitHub.

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

To display an image, simply wrap the image’s URL in ! (exclamation points). If you want to link the image to a URL, you can blend the image and link syntax: place your image URL in the exclamation points and suffix that with a colon and your URL. For example, an image at http://myurl/image.png that should link to http://myurl/ should be written as !http://myurl/image.png!:http://myurl/.

' } ] } ]; $.GollumEditor.defineHelp('textile', TextileHelp); })(jQuery);