From 449515792a939d98e5ed9f768e76769689a40e48 Mon Sep 17 00:00:00 2001 From: Eston Bond Date: Wed, 1 Dec 2010 15:40:54 -0800 Subject: [PATCH] Adding help for ASCIIDoc, fixing pod help --- .../gollum-editor/langs/asciidoc.js | 62 +++++++++++++++++++ .../javascript/gollum-editor/langs/pod.js | 26 ++++---- 2 files changed, 74 insertions(+), 14 deletions(-) mode change 100644 => 100755 lib/gollum/frontend/public/javascript/gollum-editor/langs/asciidoc.js diff --git a/lib/gollum/frontend/public/javascript/gollum-editor/langs/asciidoc.js b/lib/gollum/frontend/public/javascript/gollum-editor/langs/asciidoc.js old mode 100644 new mode 100755 index 0d32ca03..a97ff53b --- a/lib/gollum/frontend/public/javascript/gollum-editor/langs/asciidoc.js +++ b/lib/gollum/frontend/public/javascript/gollum-editor/langs/asciidoc.js @@ -104,4 +104,66 @@ var ASCIIDoc = { jQuery.GollumEditor.defineLanguage('asciidoc', ASCIIDoc); + +var ASCIIDocHelp = [ + { + menuName: 'Text Formatting', + content: [ + { + menuName: 'Headers', + data: '

ASCIIDoc headers can be written in two ways: with differing underlines or with different indentation using = (equals sign). ASCIIDoc supports headings 1-4. The editor will automatically use the = notation. To create a level one header, prefix your line with one =. Level two headers are created with == and so on.

' + }, + { + menuName: 'Bold / Italic', + data: '

To display text as bold, wrap the text in * (asterisks). To display text as italic, wrap the text in _ (underscores). To create monospace text, wrap the text in + (plus signs).' + }, + { + menuName: 'Scripts', + data: '

Superscript and subscript is created the same way as other inline formats. To create superscript text, wrap your text in ^ (carats). To create subscript text, wrap your text in ~ (tildes).

' + }, + { + menuName: 'Special Characters', + data: '

ASCIIDoc will automatically convert textual representations of commonly-used special characters. For example, (R) becomes ®, (C) becomes © and (TM) becomes ™.

' + } + ] + }, + { + menuName: 'Blocks', + content: [ + { + menuName: 'Paragraphs', + data: '

ASCIIDoc allows paragraphs to have optional titles or icons to denote special sections. To make a normal paragraph, simply add a line between blocks and a new paragraph will start. If you want to title your paragraphs, adda line prefixed by . (full stop). An example paragraph with optional title is displayed below:

.Optional Title

This is my paragraph. It is two sentences long.

' + }, + { + menuName: 'Source Blocks', + data: '

To create source blocks (long blocks of code), follow the same syntax as above but with an extra line denoting the inline source and lines of four dashes (----) delimiting the source block.. An example of Python source is below:

.python.py
[source,python]
----
# i just wrote a comment in python
# and maybe one more
----

' + }, + { + menuName: 'Comment Blocks', + data: '

Comment blocks are useful if you want to keep notes for yourself inline but do not want them displayed to the public. To create a comment block, simply wrap the paragraph in dividers with four slashes (////). An example comment block is below:

////
My comment block is here now

It can be multiple paragraphs. Really.
////

' + }, + { + menuName: 'Quote Blocks', + data: '

Quote blocks work much like comment blocks — simply create dividers using four underscores (____) around your quote. An example quote block is displayed below:
____
This is my quote block. Quote something nice here, otherwise there is no point in quoting.
____

' + } + ] + }, + { + menuName: 'Macros', + content: [ + { + menuName: 'Links', + data: '

To create links to external pages, you can simply write the URI if you want the URI to link to itself. (i.e., http://github.com/ will automatically be parsed to http://github.com/. If you want different text to be displayed, simply append it to the end of the URI in between [ (brackets.) For example, http://github.com/[GitHub] will be parsed as GitHub, with the URI pointing to http://github.com.

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

Images in ASCIIDoc work much like hyperlinks, but image URLs are prefixed with image:. For example, to link to an image at images/icons/home.png, write image:images/icons/home.png. Alt text can be added by appending the text to the URI in [ (brackets).

' + } + ] + } +]; + +jQuery.GollumEditor.defineHelp('asciidoc', ASCIIDocHelp); + })(); + diff --git a/lib/gollum/frontend/public/javascript/gollum-editor/langs/pod.js b/lib/gollum/frontend/public/javascript/gollum-editor/langs/pod.js index 4d35f65c..d50dd1f0 100755 --- a/lib/gollum/frontend/public/javascript/gollum-editor/langs/pod.js +++ b/lib/gollum/frontend/public/javascript/gollum-editor/langs/pod.js @@ -78,7 +78,7 @@ var PodHelp = [ data: '

All command paragraphs start with = (equals sign).

To create headings 1 through 4, begin your command paragraph with =headN, where N is the number of the heading 1 through 4. For example, to make a first-order heading (the largest possible,) write =head1, then on the next line begin your paragraph that you want under the heading.

' }, { - menuName: 'Beginning and Ending', + menuName: 'Beginning & Ending', data: '

Perl pod blocks should begin with =pod and end with =cut, signifying to Pod parsers that the pod block has begun and ended. These command paragraphs only signal the beginning and end of a pod block.

' }, { @@ -92,19 +92,17 @@ var PodHelp = [ ] }, { - { - menuName: 'Formatting', - content: [ - { - menuName: 'Text', - data: '

Formatting text as bold, italic or code works in the S<word> syntax, where S is an abbreviation for the type of text you are trying to create. For example, B<my bold text> becomes my bold text, I<italic text> becomes italic text and C<code here()> becomes code here().

' - }, - { - menuName: 'Hyperlinks', - data: '

Writing hyperlinks in pod is much like formatting text, using the same S<> syntax. Instead of B, I or C, use L to begin a hyperlink.

pod allows you to hyperlink to a man page, a Perl documentation page, or another web page. To link to a man or Perl documentation page, simply include the page name in the link (e.g. L<perl(1)> or L<Net::Ping>). If you want to link to a web page, separate the URL and the link text with a pipe (e.g. to link to github.com, write L<GitHub|http://github.com/>).' - } - ] - } + menuName: 'Formatting', + content: [ + { + menuName: 'Text', + data: '

Formatting text as bold, italic or code works in the S<word> syntax, where S is an abbreviation for the type of text you are trying to create. For example, B<my bold text> becomes my bold text, I<italic text> becomes italic text and C<code here()> becomes code here().

' + }, + { + menuName: 'Hyperlinks', + data: '

Writing hyperlinks in pod is much like formatting text, using the same S<> syntax. Instead of B, I or C, use L to begin a hyperlink.

pod allows you to hyperlink to a man page, a Perl documentation page, or another web page. To link to a man or Perl documentation page, simply include the page name in the link (e.g. L<perl(1)> or L<Net::Ping>). If you want to link to a web page, separate the URL and the link text with a pipe (e.g. to link to github.com, write L<GitHub|http://github.com/>).' + } + ] } ];