read-only-gollum 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. data/Gemfile +4 -0
  2. data/HISTORY.md +102 -0
  3. data/Home.md +3 -0
  4. data/LICENSE +21 -0
  5. data/README.md +477 -0
  6. data/Rakefile +142 -0
  7. data/bin/read-only-gollum +126 -0
  8. data/docs/sanitization.md +32 -0
  9. data/lib/gollum.rb +41 -0
  10. data/lib/gollum/blob_entry.rb +78 -0
  11. data/lib/gollum/committer.rb +218 -0
  12. data/lib/gollum/file.rb +64 -0
  13. data/lib/gollum/frontend/app.rb +225 -0
  14. data/lib/gollum/frontend/public/css/dialog.css +141 -0
  15. data/lib/gollum/frontend/public/css/editor.css +537 -0
  16. data/lib/gollum/frontend/public/css/gollum.css +660 -0
  17. data/lib/gollum/frontend/public/css/ie7.css +69 -0
  18. data/lib/gollum/frontend/public/css/template.css +381 -0
  19. data/lib/gollum/frontend/public/images/icon-sprite.png +0 -0
  20. data/lib/gollum/frontend/public/javascript/editor/gollum.editor.js +1096 -0
  21. data/lib/gollum/frontend/public/javascript/editor/langs/asciidoc.js +167 -0
  22. data/lib/gollum/frontend/public/javascript/editor/langs/creole.js +104 -0
  23. data/lib/gollum/frontend/public/javascript/editor/langs/markdown.js +211 -0
  24. data/lib/gollum/frontend/public/javascript/editor/langs/org.js +173 -0
  25. data/lib/gollum/frontend/public/javascript/editor/langs/pod.js +111 -0
  26. data/lib/gollum/frontend/public/javascript/editor/langs/rdoc.js +74 -0
  27. data/lib/gollum/frontend/public/javascript/editor/langs/textile.js +175 -0
  28. data/lib/gollum/frontend/public/javascript/gollum.dialog.js +263 -0
  29. data/lib/gollum/frontend/public/javascript/gollum.js +161 -0
  30. data/lib/gollum/frontend/public/javascript/gollum.placeholder.js +54 -0
  31. data/lib/gollum/frontend/public/javascript/jquery.color.js +123 -0
  32. data/lib/gollum/frontend/public/javascript/jquery.js +7179 -0
  33. data/lib/gollum/frontend/templates/compare.mustache +38 -0
  34. data/lib/gollum/frontend/templates/create.mustache +17 -0
  35. data/lib/gollum/frontend/templates/edit.mustache +17 -0
  36. data/lib/gollum/frontend/templates/editor.mustache +116 -0
  37. data/lib/gollum/frontend/templates/error.mustache +8 -0
  38. data/lib/gollum/frontend/templates/history.mustache +58 -0
  39. data/lib/gollum/frontend/templates/layout.mustache +28 -0
  40. data/lib/gollum/frontend/templates/page.mustache +37 -0
  41. data/lib/gollum/frontend/templates/pages.mustache +35 -0
  42. data/lib/gollum/frontend/templates/search.mustache +36 -0
  43. data/lib/gollum/frontend/templates/searchbar.mustache +10 -0
  44. data/lib/gollum/frontend/views/compare.rb +94 -0
  45. data/lib/gollum/frontend/views/create.rb +48 -0
  46. data/lib/gollum/frontend/views/edit.rb +52 -0
  47. data/lib/gollum/frontend/views/editable.rb +13 -0
  48. data/lib/gollum/frontend/views/error.rb +7 -0
  49. data/lib/gollum/frontend/views/history.rb +44 -0
  50. data/lib/gollum/frontend/views/layout.rb +20 -0
  51. data/lib/gollum/frontend/views/page.rb +57 -0
  52. data/lib/gollum/frontend/views/pages.rb +19 -0
  53. data/lib/gollum/frontend/views/search.rb +20 -0
  54. data/lib/gollum/git_access.rb +248 -0
  55. data/lib/gollum/markup.rb +489 -0
  56. data/lib/gollum/page.rb +430 -0
  57. data/lib/gollum/pagination.rb +61 -0
  58. data/lib/gollum/sanitization.rb +174 -0
  59. data/lib/gollum/tex.rb +89 -0
  60. data/lib/gollum/web_sequence_diagram.rb +43 -0
  61. data/lib/gollum/wiki.rb +636 -0
  62. data/read-only-gollum.gemspec +224 -0
  63. data/templates/formatting.html +92 -0
  64. data/test/examples/empty.git/HEAD +1 -0
  65. data/test/examples/empty.git/config +5 -0
  66. data/test/examples/empty.git/description +1 -0
  67. data/test/examples/empty.git/hooks/applypatch-msg.sample +15 -0
  68. data/test/examples/empty.git/hooks/commit-msg.sample +24 -0
  69. data/test/examples/empty.git/hooks/post-commit.sample +8 -0
  70. data/test/examples/empty.git/hooks/post-receive.sample +15 -0
  71. data/test/examples/empty.git/hooks/post-update.sample +8 -0
  72. data/test/examples/empty.git/hooks/pre-applypatch.sample +14 -0
  73. data/test/examples/empty.git/hooks/pre-commit.sample +46 -0
  74. data/test/examples/empty.git/hooks/pre-rebase.sample +169 -0
  75. data/test/examples/empty.git/hooks/prepare-commit-msg.sample +36 -0
  76. data/test/examples/empty.git/hooks/update.sample +128 -0
  77. data/test/examples/empty.git/info/exclude +6 -0
  78. data/test/examples/empty.git/objects/info/.gitkeep +0 -0
  79. data/test/examples/empty.git/objects/pack/.gitkeep +0 -0
  80. data/test/examples/empty.git/refs/heads/.gitkeep +0 -0
  81. data/test/examples/lotr.git/COMMIT_EDITMSG +1 -0
  82. data/test/examples/lotr.git/HEAD +1 -0
  83. data/test/examples/lotr.git/ORIG_HEAD +1 -0
  84. data/test/examples/lotr.git/config +12 -0
  85. data/test/examples/lotr.git/description +1 -0
  86. data/test/examples/lotr.git/index +0 -0
  87. data/test/examples/lotr.git/info/exclude +6 -0
  88. data/test/examples/lotr.git/logs/HEAD +3 -0
  89. data/test/examples/lotr.git/logs/refs/heads/master +3 -0
  90. data/test/examples/lotr.git/objects/06/131480411710c92a82fe2d1e76932c70feb2e5 +0 -0
  91. data/test/examples/lotr.git/objects/0a/de1e2916346d4c1f2fb63b863fd3c16808fe44 +0 -0
  92. data/test/examples/lotr.git/objects/0e/d8cbe0a25235bd867e65193c7d837c66b328ef +3 -0
  93. data/test/examples/lotr.git/objects/12/629d666c5e3178f82f533f543d61b53dc78c0b +0 -0
  94. data/test/examples/lotr.git/objects/1d/b89ebba7e2c14d93b94ff98cfa3708a4f0d4e3 +2 -0
  95. data/test/examples/lotr.git/objects/24/49c2681badfd3c189e8ed658dacffe8ba48fe5 +0 -0
  96. data/test/examples/lotr.git/objects/25/4bdc1ba27d8b8a794538a8522d9a2b56ec2dd9 +0 -0
  97. data/test/examples/lotr.git/objects/2c/b9156ad383914561a8502fc70f5a1d887e48ad +4 -0
  98. data/test/examples/lotr.git/objects/5d/cac289a8603188d2c5caf481dcba2985126aaa +0 -0
  99. data/test/examples/lotr.git/objects/60/f12f4254f58801b9ee7db7bca5fa8aeefaa56b +0 -0
  100. data/test/examples/lotr.git/objects/71/4323c104239440a5c66ab12a67ed07a83c404f +0 -0
  101. data/test/examples/lotr.git/objects/84/0ec5b1ba1320e8ec443f28f99566f615d5af10 +0 -0
  102. data/test/examples/lotr.git/objects/93/6b83ee0dd8837adb82511e40d5e4ebe59bb675 +0 -0
  103. data/test/examples/lotr.git/objects/94/523d7ae48aeba575099dd12926420d8fd0425d +2 -0
  104. data/test/examples/lotr.git/objects/96/97dc65e095658bbd1b8e8678e08881e86d32f1 +0 -0
  105. data/test/examples/lotr.git/objects/a3/1ca2a7c352c92531a8b99815d15843b259e814 +0 -0
  106. data/test/examples/lotr.git/objects/a6/59b3763b822dd97544621fd0beef162ea37b14 +4 -0
  107. data/test/examples/lotr.git/objects/a8/ad3c09dd842a3517085bfadd37718856dee813 +0 -0
  108. data/test/examples/lotr.git/objects/aa/b61fe89d56f8614c0a8151da34f939dcedfa68 +0 -0
  109. data/test/examples/lotr.git/objects/bc/4b5fc0ce2c2ba3acef6647e4f67256ee45ab60 +0 -0
  110. data/test/examples/lotr.git/objects/c3/b43e9f08966b088e7a0192e436b7a884542e05 +0 -0
  111. data/test/examples/lotr.git/objects/dc/596d6b2dd89ab05c66f4abd7d5eb706bc17f19 +0 -0
  112. data/test/examples/lotr.git/objects/ec/da3205bee14520aab5a7bb307392064b938e83 +0 -0
  113. data/test/examples/lotr.git/objects/f4/84ebb1f40f8eb20d1bcd8d1d71934d2b8ae961 +0 -0
  114. data/test/examples/lotr.git/objects/fa/e7ef5344202bba4129abdc13060d9297d99465 +3 -0
  115. data/test/examples/lotr.git/objects/info/packs +2 -0
  116. data/test/examples/lotr.git/objects/pack/pack-dcbeaf3f6ff6c5eb08ea2b0a2d83626e8763546b.idx +0 -0
  117. data/test/examples/lotr.git/objects/pack/pack-dcbeaf3f6ff6c5eb08ea2b0a2d83626e8763546b.pack +0 -0
  118. data/test/examples/lotr.git/packed-refs +2 -0
  119. data/test/examples/lotr.git/refs/heads/master +1 -0
  120. data/test/examples/lotr.git/refs/remotes/origin/HEAD +1 -0
  121. data/test/examples/page_file_dir.git/COMMIT_EDITMSG +1 -0
  122. data/test/examples/page_file_dir.git/HEAD +1 -0
  123. data/test/examples/page_file_dir.git/config +6 -0
  124. data/test/examples/page_file_dir.git/description +1 -0
  125. data/test/examples/page_file_dir.git/index +0 -0
  126. data/test/examples/page_file_dir.git/info/exclude +6 -0
  127. data/test/examples/page_file_dir.git/logs/HEAD +1 -0
  128. data/test/examples/page_file_dir.git/logs/refs/heads/master +1 -0
  129. data/test/examples/page_file_dir.git/objects/0c/7d27db1f575263efdcab3dc650f4502a2dbcbf +0 -0
  130. data/test/examples/page_file_dir.git/objects/22/b404803c966dd92865614d86ff22ca12e50c1e +0 -0
  131. data/test/examples/page_file_dir.git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99 +0 -0
  132. data/test/examples/page_file_dir.git/objects/57/16ca5987cbf97d6bb54920bea6adde242d87e6 +0 -0
  133. data/test/examples/page_file_dir.git/objects/5b/43e14e0a15fb6f08feab1773d1c0991e9f71e2 +0 -0
  134. data/test/examples/page_file_dir.git/refs/heads/master +1 -0
  135. data/test/examples/revert.git/COMMIT_EDITMSG +1 -0
  136. data/test/examples/revert.git/HEAD +1 -0
  137. data/test/examples/revert.git/config +12 -0
  138. data/test/examples/revert.git/description +1 -0
  139. data/test/examples/revert.git/index +0 -0
  140. data/test/examples/revert.git/info/exclude +6 -0
  141. data/test/examples/revert.git/logs/HEAD +2 -0
  142. data/test/examples/revert.git/logs/refs/heads/master +2 -0
  143. data/test/examples/revert.git/objects/20/2ced67cea93c7b6bd2928aa1daef8d1d55a20d +0 -0
  144. data/test/examples/revert.git/objects/41/76394bfa11222363c66ce7e84b5f154095b6d9 +0 -0
  145. data/test/examples/revert.git/objects/6a/69f92020f5df77af6e8813ff1232493383b708 +0 -0
  146. data/test/examples/revert.git/objects/b4/785957bc986dc39c629de9fac9df46972c00fc +0 -0
  147. data/test/examples/revert.git/objects/f4/03b791119f8232b7cb0ba455c624ac6435f433 +0 -0
  148. data/test/examples/revert.git/objects/info/packs +2 -0
  149. data/test/examples/revert.git/objects/pack/pack-a561f8437234f74d0bacb9e0eebe52d207f5770d.idx +0 -0
  150. data/test/examples/revert.git/objects/pack/pack-a561f8437234f74d0bacb9e0eebe52d207f5770d.pack +0 -0
  151. data/test/examples/revert.git/packed-refs +2 -0
  152. data/test/examples/revert.git/refs/heads/master +1 -0
  153. data/test/examples/revert.git/refs/remotes/origin/HEAD +1 -0
  154. data/test/examples/yubiwa.git/HEAD +1 -0
  155. data/test/examples/yubiwa.git/config +5 -0
  156. data/test/examples/yubiwa.git/description +1 -0
  157. data/test/examples/yubiwa.git/info/exclude +6 -0
  158. data/test/examples/yubiwa.git/objects/10/fa2ddc4e3b4009d8a453aace10bd6148c1ad00 +0 -0
  159. data/test/examples/yubiwa.git/objects/52/4b82874327ea7cbf730389964ba7cb3de966de +0 -0
  160. data/test/examples/yubiwa.git/objects/58/3fc201cb457fb3f1480f3e1e5999b119633835 +0 -0
  161. data/test/examples/yubiwa.git/objects/87/bc1dd46ab3d3874d4e898d45dd512cc20a7cc8 +1 -0
  162. data/test/examples/yubiwa.git/objects/89/64ed1b4e21aa90e831763bbce9034bfda81b70 +0 -0
  163. data/test/examples/yubiwa.git/objects/9f/f6dd0660da5fba2d3374adb2b84fa653bb538b +0 -0
  164. data/test/examples/yubiwa.git/objects/ac/e97abf2b177815a1972d7db22f229f58c83309 +0 -0
  165. data/test/examples/yubiwa.git/objects/b1/f443863a4816628807fbf86141ebef055dda34 +0 -0
  166. data/test/examples/yubiwa.git/refs/heads/master +1 -0
  167. data/test/helper.rb +66 -0
  168. data/test/test_app.rb +169 -0
  169. data/test/test_committer.rb +64 -0
  170. data/test/test_file.rb +27 -0
  171. data/test/test_git_access.rb +52 -0
  172. data/test/test_markup.rb +628 -0
  173. data/test/test_page.rb +166 -0
  174. data/test/test_page_revert.rb +45 -0
  175. data/test/test_wiki.rb +462 -0
  176. metadata +470 -0
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Org-mode Language Definition
3
+ **/
4
+ (function($) {
5
+
6
+ var OrgMode = {
7
+
8
+ 'function-bold' : {
9
+ search: /([^\n]+)([\n\s]*)/g,
10
+ replace: "*$1*$2"
11
+ },
12
+
13
+ 'function-italic' : {
14
+ search: /([^\n]+)([\n\s]*)/g,
15
+ replace: "/$1/$2"
16
+ },
17
+
18
+ 'function-code' : {
19
+ search: /(^[\n]+)([\n\s]*)/g,
20
+ replace: "=$1=$2"
21
+ },
22
+
23
+ 'function-ul' : {
24
+ search: /(.+)([\n]?)/g,
25
+ replace: "* $1$2"
26
+ },
27
+
28
+ /* This works, just like it works for Markdown */
29
+ 'function-ol' : {
30
+ search: /(.+)([\n]?)/g,
31
+ replace: "1. $1$2"
32
+ },
33
+
34
+ 'function-blockquote' : {
35
+ search: /(.+)([\n]?)/g,
36
+ replace: "#+BEGIN_QUOTE\n$1$2\n#+END_QUOTE\n"
37
+ },
38
+
39
+ 'function-h1' : {
40
+ search: /(.+)([\n]?)/g,
41
+ replace: "* $1$2"
42
+ },
43
+
44
+ 'function-h2' : {
45
+ search: /(.+)([\n]?)/g,
46
+ replace: "** $1$2"
47
+ },
48
+
49
+ 'function-h3' : {
50
+ search: /(.+)([\n]?)/g,
51
+ replace: "*** $1$2"
52
+ },
53
+
54
+ 'function-link' : {
55
+ exec: function( txt, selText, $field ) {
56
+ var results = null;
57
+ $.GollumEditor.Dialog.init({
58
+ title: 'Insert Link',
59
+ fields: [
60
+ {
61
+ id: 'text',
62
+ name: 'Link Text',
63
+ type: 'text'
64
+ },
65
+ {
66
+ id: 'href',
67
+ name: 'URL',
68
+ type: 'text'
69
+ }
70
+ ],
71
+ OK: function( res ) {
72
+ var rep = '';
73
+ if ( res['text'] && res['href'] ) {
74
+ rep = '[[' + res['href'] + '][' +
75
+ res['text'] + ']]';
76
+ }
77
+ else if ( res['href'] ) {
78
+ rep = '[[' + res['href'] + ']]';
79
+ }
80
+ $.GollumEditor.replaceSelection( rep );
81
+ }
82
+ });
83
+ }
84
+ },
85
+
86
+ 'function-image' : {
87
+ exec: function( txt, selText, $field ) {
88
+ var results = null;
89
+ $.GollumEditor.Dialog.init({
90
+ title: 'Insert Image',
91
+ fields: [
92
+ {
93
+ id: 'url',
94
+ name: 'Image URL',
95
+ type: 'text'
96
+ }
97
+ ],
98
+ OK: function( res ) {
99
+ var rep = '';
100
+ if ( res['url'] ) {
101
+ rep = '[[' + res['url'] + ']]';
102
+ }
103
+ $.GollumEditor.replaceSelection( rep );
104
+ }
105
+ });
106
+ }
107
+ }
108
+
109
+ };
110
+
111
+ var OrgModeHelp = [
112
+
113
+ {
114
+ menuName: 'Block Elements',
115
+ content: [
116
+ {
117
+ menuName: 'Paragraphs & Breaks',
118
+ data: '<p>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.</p>'
119
+ },
120
+ {
121
+ menuName: 'Headers',
122
+ data: '<p>Simply prefix your header text with the number of <code>*</code> characters to specify heading depth. For example: <code>* Header 1</code>, <code>** Header 2</code> and <code>*** Header 3</code> will be progressively smaller headers.</p>'
123
+ },
124
+ {
125
+ menuName: 'Blockquotes',
126
+ data: '<p>To create a blockquote, simple embed the text between <code>#+BEGIN_QUOTE</code> and <code>#+END_QUOTE</code>. An example quote block is displayed below:<br><code>#+BEGIN_QUOTE<br>This is my quote block. Quote something nice here, otherwise there is no point in quoting.<br>#+END_QUOTE</code></p>'
127
+ },
128
+ {
129
+ menuName: 'Lists',
130
+ data: '<p>Org-mode supports both ordered and unordered lists. To create an ordered list, simply prefix each line with a number (any number will do &mdash; this is why the editor only uses one number.) To create an unordered list, you can prefix each line with <code>+</code> or <code>-</code>.</p>'
131
+ },
132
+ {
133
+ menuName: 'Code Blocks',
134
+ data: '<p>Code Blocks are similar to blockquote, except that <code>#+BEGIN_EXAMPLE</code> and <code>#+END_EXAMPLE</code> are used.</p>'
135
+ },
136
+ {
137
+ menuName: 'Tables',
138
+ data: '<p>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 <code>|</code> character. For example, <br><br><code>|one|two|three|<br>|four|five|six|</code><br><br> will appear as a table with two rows and three columns. Additionally, <br><br><code>|one|two|three|<br>|---+---+-----|<br>|four|five|six|</code><br><br> will also appear as a table, but the first row will be interpreted as a header row and the <code>&lt;th&gt;</code> tag will be used to render it. </p>'
139
+ }
140
+ ]
141
+ },
142
+
143
+ {
144
+ menuName: 'Span Elements',
145
+ content: [
146
+ {
147
+ menuName: 'Links',
148
+ data: '<p>To create links to external pages, you need to enclose the URI in double square brackets. (i.e., <code>[[http://github.com/]]</code> will automatically be parsed to <a href="javascript:void(0);">http://github.com/</a>)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 &ldquo;GitHub&rdquo;, you write <code>[[http://github.com][GitHub]]</code>.</p>'
149
+ },
150
+
151
+ {
152
+ menuName: 'Emphasis',
153
+ data: '<p>Forward slashes (<code>/</code>) are treated as emphasis and are wrapped with an <code>&lt;i&gt;</code> tag. Asterisks (<code>*</code>) are treated as bold using the <code>&lt;b&gt;</code> tag.</p>'
154
+ },
155
+
156
+ {
157
+ menuName: 'Code',
158
+ data: '<p>To create inline spans of code, simply wrap the code in equal signs (<code>=</code>). Orgmode will turn <code>=myFunction=</code> into <code>myFunction</code>.</p>'
159
+ },
160
+
161
+ {
162
+ menuName: 'Images',
163
+ data: "<p>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.</p>"
164
+ }
165
+ ]
166
+ }
167
+ ];
168
+
169
+
170
+ $.GollumEditor.defineLanguage('org', OrgMode);
171
+ $.GollumEditor.defineHelp('org', OrgModeHelp);
172
+
173
+ })(jQuery);
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Pod Language Definition
3
+ **/
4
+ (function($) {
5
+
6
+ var Pod = {
7
+
8
+ 'function-bold' : {
9
+ search: /(^[\n]+)([\n\s]*)/g,
10
+ replace: "B<$1>$2"
11
+ },
12
+
13
+ 'function-italic' : {
14
+ search: /(^[\n]+)([\n\s]*)/g,
15
+ replace: "I<$1>$2"
16
+ },
17
+
18
+ 'function-code' : {
19
+ search: /(^[\n]+)([\n\s]*)/g,
20
+ replace: "C<$1>$2"
21
+ },
22
+
23
+ 'function-h1' : {
24
+ search: /(.+)([\n]?)/gi,
25
+ replace: "=head1 $1$2"
26
+ },
27
+
28
+ 'function-h2' : {
29
+ search: /(.+)([\n]?)/gi,
30
+ replace: "=head2 $1$2"
31
+ },
32
+
33
+ 'function-h3' : {
34
+ search: /(.+)([\n]?)/gi,
35
+ replace: "=head3 $1$2"
36
+ },
37
+
38
+ 'function-link' : {
39
+ exec: function( txt, selText, $field ) {
40
+ var results = null;
41
+ $.GollumEditor.Dialog.init({
42
+ title: 'Insert Link',
43
+ fields: [
44
+ {
45
+ id: 'text',
46
+ name: 'Link Text',
47
+ type: 'text'
48
+ },
49
+ {
50
+ id: 'href',
51
+ name: 'URL',
52
+ type: 'text'
53
+ }
54
+ ],
55
+ OK: function( res ) {
56
+ var rep = '';
57
+ if ( res['text'] && res['href'] ) {
58
+ rep = 'L<' + res['text'] + '|' +
59
+ res['href'] + '>';
60
+ }
61
+ $.GollumEditor.replaceSelection( rep );
62
+ }
63
+ });
64
+ }
65
+ }
66
+
67
+ };
68
+
69
+ $.GollumEditor.defineLanguage('pod', Pod);
70
+
71
+
72
+ var PodHelp = [
73
+ {
74
+ menuName: 'Command Paragraphs',
75
+ content: [
76
+ {
77
+ menuName: 'Headings',
78
+ data: '<p>All command paragraphs start with <code>=</code> (equals sign).</p><p>To create headings 1 through 4, begin your command paragraph with <code>=headN</code>, where <code>N</code> is the number of the heading 1 through 4. For example, to make a first-order heading (the largest possible,) write <code>=head1</code>, then on the next line begin your paragraph that you want under the heading.</p>'
79
+ },
80
+ {
81
+ menuName: 'Beginning &amp; Ending',
82
+ data: '<p>Perl pod blocks should begin with <code>=pod</code> and end with <code>=cut</code>, 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.</p>'
83
+ },
84
+ {
85
+ menuName: 'Other Formats',
86
+ data: '<p>pod also allows blocks in other formats, such as HTML or plain text. To create one of these blocks, use the <code>=format SYNTAX</code> command paragraph, where <code>SYNTAX</code> is the syntax of the block (e.g. <code>html</code> or <code>txt</code>). At the end of your block, use the <code>=end SYNTAX</code> block.</p>'
87
+ },
88
+ {
89
+ menuName: 'Encoding',
90
+ data: '<p>If you are having encoding troubles, use the <code>=encoding ENC_TYPE</code> command, where <code>ENC_TYPE</code> is the encoding type (e.g. <code>utf8</code>, <code>koi8-r</code>). This will affect the entire document, not just the block below the command.</p>'
91
+ }
92
+ ]
93
+ },
94
+ {
95
+ menuName: 'Formatting',
96
+ content: [
97
+ {
98
+ menuName: 'Text',
99
+ data: '<p>Formatting text as <strong>bold</strong>, <em>italic</em> or <code>code</code> works in the <code>S&lt;word&gt;</code> syntax, where <code>S</code> is an abbreviation for the type of text you are trying to create. For example, <code>B&lt;my bold text&gt;</code> becomes <strong>my bold text</strong>, <code>I&lt;italic text&gt;</code> becomes <em>italic text</em> and <code>C&lt;code here()&gt;</code> becomes <code>code here()</code>.</p>'
100
+ },
101
+ {
102
+ menuName: 'Hyperlinks',
103
+ data: '<p>Writing hyperlinks in pod is much like formatting text, using the same <code>S&lt;&gt;</code> syntax. Instead of <code>B</code>, <code>I</code> or <code>C</code>, use <code>L</code> to begin a hyperlink.</p><p>pod allows you to hyperlink to a <code>man</code> page, a Perl documentation page, or another web page. To link to a <code>man</code> or Perl documentation page, simply include the page name in the link (e.g. <code>L&lt;perl(1)&gt;</code> or <code>L&lt;Net::Ping&gt;</code>). 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 <code>L&lt;GitHub|http://github.com/&gt;</code>).'
104
+ }
105
+ ]
106
+ }
107
+ ];
108
+
109
+ $.GollumEditor.defineHelp('pod', PodHelp);
110
+
111
+ })(jQuery);
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Markdown Language Definition
3
+ *
4
+ * A language definition for string manipulation operations, in this case
5
+ * for the Markdown, uh, markup language. Uses regexes for various functions
6
+ * by default. If regexes won't do and you need to do some serious
7
+ * manipulation, you can declare a function in the object instead.
8
+ *
9
+ * Code example:
10
+ * 'functionbar-id' : {
11
+ * exec: function(text, selectedText) {
12
+ * functionStuffHere();
13
+ * },
14
+ * search: /somesearchregex/gi,
15
+ * replace: 'replace text for RegExp.replace',
16
+ * append: "just add this where the cursor is"
17
+ * }
18
+ *
19
+ **/
20
+ (function($) {
21
+
22
+ var RDoc = {
23
+
24
+ 'function-bold' : {
25
+ search: /([^\n]+)([\n\s]*)/g,
26
+ replace: "((*$1*))$2"
27
+ },
28
+ 'function-code' : {
29
+ search: /([^\n]+)([\n\s]*)/g,
30
+ replace: "(({$1}))$2"
31
+ },
32
+
33
+ 'function-ul' : {
34
+ search: /(.+)([\n]?)/gi,
35
+ replace: "* $1$2"
36
+ },
37
+
38
+ 'function-ol' : {
39
+ exec: function( txt, selText, $field ) {
40
+ var count = 1;
41
+ // split into lines
42
+ var repText = '';
43
+ var lines = selText.split("\n");
44
+ var hasContent = /[\w]+/;
45
+ for ( var i = 0; i < lines.length; i++ ) {
46
+ if ( hasContent.test(lines[i]) ) {
47
+ repText += '(' + (i + 1).toString() + ') ' +
48
+ lines[i];
49
+ }
50
+ }
51
+ $.GollumEditor.replaceSelection( repText );
52
+ }
53
+ },
54
+
55
+ 'function-h1' : {
56
+ search: /(.+)([\n]?)/gi,
57
+ replace: "= $1$2"
58
+ },
59
+
60
+ 'function-h2' : {
61
+ search: /(.+)([\n]?)/gi,
62
+ replace: "== $1$2"
63
+ },
64
+
65
+ 'function-h3' : {
66
+ search: /(.+)([\n]?)/gi,
67
+ replace: "=== $1$2"
68
+ }
69
+
70
+ };
71
+
72
+ $.GollumEditor.defineLanguage('rdoc', RDoc);
73
+
74
+ })(jQuery);
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Textile Language Definition
3
+ */
4
+ (function($) {
5
+
6
+ var Textile = {
7
+
8
+ 'function-bold' : {
9
+ search: /(^[\n]+)([\n\s]*)/g,
10
+ replace: "*$1*$2"
11
+ },
12
+
13
+ 'function-italic' : {
14
+ search: /(^[\n]+)([\n\s]*)/g,
15
+ replace: "_$1_$2"
16
+ },
17
+
18
+ 'function-hr' : {
19
+ append: "\n***\n"
20
+ },
21
+
22
+ 'function-code' : {
23
+ search: /(^[\n]+)([\n\s]*)/g,
24
+ replace: "<pre><code>$1</code></pre>$2"
25
+ },
26
+
27
+ 'function-ul' : {
28
+ search: /(.+)([\n]?)/gi,
29
+ replace: "* $1$2"
30
+ },
31
+
32
+ 'function-ol' : {
33
+ search: /(.+)([\n]?)/gi,
34
+ replace: "# $1$2"
35
+ },
36
+
37
+ 'function-blockquote' : {
38
+ search: /(.+)([\n]?)/gi,
39
+ replace: "bq. $1$2"
40
+ },
41
+
42
+ 'function-link' : {
43
+ exec: function( txt, selText, $field ) {
44
+ var results = null;
45
+ $.GollumEditor.Dialog.init({
46
+ title: 'Insert Link',
47
+ fields: [
48
+ {
49
+ id: 'text',
50
+ name: 'Link Text',
51
+ type: 'text',
52
+ help: 'The text to display to the user.'
53
+ },
54
+ {
55
+ id: 'href',
56
+ name: 'URL',
57
+ type: 'text',
58
+ help: 'The URL to link to.'
59
+ }
60
+ ],
61
+ OK: function( res ) {
62
+ var h = '';
63
+ if ( res['text'] && res['href'] ) {
64
+ h = '"' + res['text'] + '":' +
65
+ res['href'];
66
+ }
67
+ $.GollumEditor.replaceSelection( h );
68
+ }
69
+ });
70
+
71
+
72
+ }
73
+ },
74
+
75
+ 'function-image' : {
76
+ exec: function( txt, selText, $field ) {
77
+ var results = null;
78
+ $.GollumEditor.Dialog.init({
79
+ title: 'Insert Image',
80
+ fields: [
81
+ {
82
+ id: 'url',
83
+ name: 'Image URL',
84
+ type: 'text'
85
+ },
86
+ {
87
+ id: 'alt',
88
+ name: 'Alt Text',
89
+ type: 'text'
90
+ }
91
+ ],
92
+ OK: function( res ) {
93
+ if ( res['url'] ) {
94
+ var h = '!' + res['url'];
95
+ if ( res['alt'] != '' ) {
96
+ h += '(' + res['alt'] + ')';
97
+ }
98
+ h += '!';
99
+ $.GollumEditor.replaceSelection( h );
100
+ }
101
+ }
102
+ });
103
+ }
104
+ }
105
+
106
+ };
107
+
108
+ $.GollumEditor.defineLanguage('textile', Textile);
109
+
110
+
111
+ var TextileHelp = [
112
+ {
113
+ menuName: 'Phrase Modifiers',
114
+ content: [
115
+ {
116
+ menuName: 'Emphasis / Strength',
117
+ data: '<p>To place emphasis or strength on inline text, simply place <code>_</code> (underscores) around the text for emphasis or <code>*</code> (asterisks) around the text for strength. In most browsers, <code>_mytext_</code> will appear as italics and <code>*mytext*</code> will appear as bold.</p><p>To force italics or bold, simply double the characters: <code>__mytext__</code> will appear italic and <code>**mytext**</code> will appear as bold text.</p>'
118
+ },
119
+ {
120
+ menuName: 'Citations / Editing',
121
+ data: '<p>To display citations, wrap your text in <code>??</code> (two question marks).</p><p>To display edit marks such as deleted text (strikethrough) or inserted text (underlined text), wrap your text in <code>-</code> (minuses) or <code>+</code> (pluses). For example <code>-mytext-</code> will be rendered as <span style="text-decoration: line-through;">mytext</span> and <code>+mytext+</code> will be rendered as <span style="text-decoration: underline;">mytext</span></p>'
122
+ },
123
+ {
124
+ menuName: 'Superscript / Subscript',
125
+ data: '<p>To display superscript, wrap your text in <code>^</code> (carets). To display subscript, wrap your text in <code>~</code> (tildes).</p>'
126
+ },
127
+ {
128
+ menuName: 'Code',
129
+ data: '<p>To display monospace code, wrap your text in <code>@</code> (at symbol). For example, <code>@mytext@</code> will appear as <code>mytext</code>.</p>'
130
+ },
131
+ {
132
+ menuName: 'Acronyms',
133
+ data: '<p>To create an acronym, suffix the acronym with the definition in parentheses. For example, <code>JS(JavaScript)</code> will be displayed as <abbr title="JavaScript">JS</abbr>.</p>'
134
+ }
135
+ ]
136
+ },
137
+ {
138
+ menuName: 'Block Modifiers',
139
+ content: [
140
+ {
141
+ menuName: 'Headings',
142
+ data: '<p>To display a heading in Textile, prefix your line of text with <code>hn.</code>, where <code>n</code> equals the heading size you want (1 is largest, 6 is smallest).</p>'
143
+ },
144
+ {
145
+ menuName: 'Paragraphs / Quotes',
146
+ data: '<p>To create a new paragraph, prefix your first line of a block of text with <code>p.</code>.</p><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 <code>bq.</code> If you need to extend a blockquote to more than one text block, write <code>bq..</code> (note the two periods) and prefix your next normal paragraph with <code>p.</code></p>'
147
+ },
148
+ {
149
+ menuName: 'Code Blocks',
150
+ data: '<p>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 <code>bc.</code></p><p>To display a preformatted block, prefix the block with <code>pre.</code></p>'
151
+ },
152
+ {
153
+ menuName: 'Lists',
154
+ data: '<p>To create ordered lists, prefix each line with <code>#</code>. To create unordered lists, prefix each line with <code>*</code>.</p>'
155
+ }
156
+ ]
157
+ },
158
+ {
159
+ menuName: 'Links / Images',
160
+ content: [
161
+ {
162
+ menuName: 'Links',
163
+ data: '<p>To display a link, put the text you want to display in quotes, then a colon (<code>:</code>), then the URL after the colon. For example <code>&quot;GitHub&quot;:http://github.com/</code> will appear as <a href="javascript:void(0);">GitHub</a>.</p>'
164
+ },
165
+ {
166
+ menuName: 'Images',
167
+ data: '<p>To display an image, simply wrap the image&rsquo;s URL in <code>!</code> (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 <code>http://myurl/image.png</code> that should link to <code>http://myurl/</code> should be written as <code>!http://myurl/image.png!:http://myurl/</code>.</p>'
168
+ }
169
+ ]
170
+ }
171
+ ];
172
+
173
+ $.GollumEditor.defineHelp('textile', TextileHelp);
174
+
175
+ })(jQuery);