gitlab-gollum-lib 1.1.0 → 4.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -3
  3. data/HISTORY.md +25 -0
  4. data/LICENSE +1 -1
  5. data/README.md +24 -312
  6. data/Rakefile +32 -16
  7. data/gemspec.rb +110 -0
  8. data/gollum-lib.gemspec +8 -75
  9. data/gollum-lib_java.gemspec +4 -0
  10. data/lib/gollum-lib.rb +18 -6
  11. data/lib/gollum-lib/blob_entry.rb +10 -9
  12. data/lib/gollum-lib/committer.rb +37 -30
  13. data/lib/gollum-lib/file.rb +71 -15
  14. data/lib/gollum-lib/file_view.rb +53 -48
  15. data/lib/gollum-lib/filter.rb +78 -0
  16. data/lib/gollum-lib/filter/code.rb +145 -0
  17. data/lib/gollum-lib/filter/emoji.rb +39 -0
  18. data/lib/gollum-lib/filter/macro.rb +57 -0
  19. data/lib/gollum-lib/filter/metadata.rb +29 -0
  20. data/lib/gollum-lib/filter/plain_text.rb +16 -0
  21. data/lib/gollum-lib/filter/plantuml.rb +176 -0
  22. data/lib/gollum-lib/filter/remote_code.rb +63 -0
  23. data/lib/gollum-lib/filter/render.rb +20 -0
  24. data/lib/gollum-lib/filter/sanitize.rb +18 -0
  25. data/lib/gollum-lib/filter/tags.rb +327 -0
  26. data/lib/gollum-lib/filter/toc.rb +134 -0
  27. data/lib/gollum-lib/filter/wsd.rb +54 -0
  28. data/lib/gollum-lib/git_access.rb +30 -32
  29. data/lib/gollum-lib/gitcode.rb +16 -16
  30. data/lib/gollum-lib/helpers.rb +3 -3
  31. data/lib/gollum-lib/hook.rb +35 -0
  32. data/lib/gollum-lib/macro.rb +43 -0
  33. data/lib/gollum-lib/macro/all_pages.rb +11 -0
  34. data/lib/gollum-lib/macro/global_toc.rb +12 -0
  35. data/lib/gollum-lib/macro/navigation.rb +20 -0
  36. data/lib/gollum-lib/macro/series.rb +48 -0
  37. data/lib/gollum-lib/markup.rb +95 -572
  38. data/lib/gollum-lib/markups.rb +9 -3
  39. data/lib/gollum-lib/page.rb +109 -80
  40. data/lib/gollum-lib/pagination.rb +1 -1
  41. data/lib/gollum-lib/sanitization.rb +75 -75
  42. data/lib/gollum-lib/version.rb +5 -0
  43. data/lib/gollum-lib/wiki.rb +287 -129
  44. metadata +237 -92
  45. data/CHANGELOG +0 -2
  46. data/VERSION +0 -1
  47. data/lib/gollum-lib/grit_ext.rb +0 -20
  48. data/lib/gollum-lib/remote_code.rb +0 -39
  49. data/lib/gollum-lib/web_sequence_diagram.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 857716d6a1f16207ab19e636ad813203a3fbb114
4
- data.tar.gz: fc61538a081a5613cc9f4ac7a32a8d92def82017
3
+ metadata.gz: 13a758deb9f6e44c456678212eb346bed34a1b4a
4
+ data.tar.gz: daada1013c176851708db52282f89c63179fa09f
5
5
  SHA512:
6
- metadata.gz: fc11dbb64bd056a4e8f4abb27b564c1acd467bf5f8b9a6948fa396206b4a768e01401fb7f6dcf5ed53734d998b05405c1f292a59c8e248dc8fcb39ac8d4d1e10
7
- data.tar.gz: ab6744fb685b1fdd58f15f780b3551a2171cc8eb0c127425a26194f4e6745b71442f41d26abeb9c93fe64149cfdd2b5c9da6af29c8bb948ad63d185afaeee7df
6
+ metadata.gz: b19591dea0b63468ed1544a579d6087dd0bb85605f2ab0d3b89bddc37922172a6eefa0ac7fe396e51b819d163f43e353afef86d20ec5c0762ad2548530d1d4e2
7
+ data.tar.gz: db2418c60db2f9aeeb602f6c2f2c37856c6868e24465ff50d12fb55dd4991113ef057df95d4a548b4c566e3dea163832bb5375eb35333a81d4dcb5632e7ea42d
data/Gemfile CHANGED
@@ -1,4 +1,2 @@
1
1
  source 'https://rubygems.org'
2
-
3
- gemspec
4
- gem 'rake', '~> 10.0.3'
2
+ gemspec :name => 'gollum-lib'
data/HISTORY.md ADDED
@@ -0,0 +1,25 @@
1
+ # v4.2.1
2
+
3
+ * Performances improvements
4
+ * Dependency updates
5
+
6
+ # v4.2.0
7
+
8
+ * Changes since v4.1.0:
9
+ ** Various performance improvements
10
+ ** Dependency updates
11
+ ** Bugfixes
12
+ ** New Macro for listing contents of (sub)directories: `Navigation()`
13
+ ** Table of Contents now supports setting max heading level
14
+
15
+ # v4.0.2 /2015-0119
16
+
17
+ * Bugfixes
18
+
19
+ # v4.0.1 /2014-12-04
20
+
21
+ * Security fix for [remote code execution issue](https://github.com/gollum/gollum/issues/913). Please update!
22
+
23
+ # v0.0.1 / 2013-03-19
24
+
25
+ * First release, extrated from https://github.com/gollum/gollum
data/LICENSE CHANGED
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
- gollum lib -- A wiki built on top of Git
1
+ gollum lib -- A wiki built on top of Git [![build status](https://ci.gitlab.org/projects/7/status.png?ref=master)](https://ci.gitlab.org/projects/7?ref=master)
2
2
  ========================================
3
3
 
4
- [![Build Status](https://travis-ci.org/gollum/gollum-lib.png)](https://travis-ci.org/gollum/gollum-lib)
5
- [![Dependency Status](https://gemnasium.com/gollum/gollum-lib.png)](https://gemnasium.com/gollum/gollum-lib)
4
+ [![Gem Version](https://badge.fury.io/rb/gollum-lib.svg)](http://badge.fury.io/rb/gollum-lib)
5
+ [![Build Status](https://travis-ci.org/gollum/gollum-lib.svg?branch=master)](https://travis-ci.org/gollum/gollum-lib)
6
+ [![Dependency Status](https://gemnasium.com/gollum/gollum-lib.svg)](https://gemnasium.com/gollum/gollum-lib)
6
7
 
7
8
  ## DESCRIPTION
8
9
 
@@ -18,10 +19,9 @@ Gollum-lib follows the rules of [Semantic Versioning](http://semver.org/) and us
18
19
 
19
20
  ## SYSTEM REQUIREMENTS
20
21
 
21
- - Python 2.5+ (2.7.3 recommended)
22
- - Ruby 1.8.7+ (1.9.3 recommended)
22
+ - Ruby 1.9.3+ (>2.0 recommended)
23
23
  - Unix like operating system (OS X, Ubuntu, Debian, and more)
24
- - Will not work on Windows (because of [grit](https://github.com/github/grit))
24
+ - Will not work on Windows with the default [grit](https://github.com/github/grit) adapter, but might work via JRuby (please let us know!)
25
25
 
26
26
  ## INSTALLATION
27
27
 
@@ -42,7 +42,7 @@ In order to use the various formats that Gollum supports, you will need to
42
42
  separately install the necessary dependencies for each format. You only need
43
43
  to install the dependencies for the formats that you plan to use.
44
44
 
45
- * [ASCIIDoc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc` on mac or `apt-get install -y asciidoc` on Ubuntu
45
+ * [AsciiDoc](http://www.methods.co.nz/asciidoc/) -- `gem install asciidoctor`
46
46
  * [Creole](http://wikicreole.org/) -- `gem install creole`
47
47
  * [Markdown](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet`
48
48
  * [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown) -- `gem install github-markdown`
@@ -55,291 +55,12 @@ to install the dependencies for the formats that you plan to use.
55
55
 
56
56
  [bundler]: http://gembundler.com/
57
57
 
58
- ## PAGE FILES
58
+ ## SYNTAX
59
59
 
60
- Page files may be written in any format supported by
61
- [GitHub-Markup](http://github.com/github/markup) (except roff). By default,
62
- Gollum recognizes the following extensions:
60
+ Gollum supports a variety of formats and extensions (Markdown, MediaWiki, Textile, …).
61
+ On top of these formats Gollum lets you insert headers, footers, links, image, math and more.
63
62
 
64
- * ASCIIDoc: .asciidoc
65
- * Creole: .creole
66
- * Markdown: .markdown, .mdown, .mkdn, .mkd, .md
67
- * Org Mode: .org
68
- * Pod: .pod
69
- * RDoc: .rdoc
70
- * ReStructuredText: .rest.txt, .rst.txt, .rest, .rst
71
- * Textile: .textile
72
- * MediaWiki: .mediawiki, .wiki
73
-
74
- You may also register your own extensions and parsers:
75
-
76
- ```ruby
77
- Gollum::Markup.register(:angry, "Angry") do |content|
78
- content.upcase
79
- end
80
- ```
81
-
82
- Gollum detects the page file format via the extension, so files must have one
83
- of the default or registered extensions in order to be converted.
84
-
85
- Page file names may contain any printable UTF-8 character except space
86
- (U+0020) and forward slash (U+002F). If you commit a page file with any of
87
- these characters in the name it will not be accessible via the web interface.
88
-
89
- Even though page files may be placed in any directory, there is still only a
90
- single namespace for page names, so all page files should have globally unique
91
- names regardless of where they are located in the repository.
92
-
93
- The special page file `Home.ext` (where the extension is one of the supported
94
- formats) will be used as the entrance page to your wiki. If it is missing, an
95
- automatically generated table of contents will be shown instead.
96
-
97
- ## SIDEBAR FILES
98
-
99
- Sidebar files allow you to add a simple sidebar to your wiki. Sidebar files
100
- are named `_Sidebar.ext` where the extension is one of the supported formats.
101
- Sidebars affect all pages in their directory and any subdirectories that do not
102
- have a sidebar file of their own.
103
-
104
- ## HEADER FILES
105
-
106
- Header files allow you to add a simple header to your wiki. Header files must
107
- be named `_Header.ext` where the extension is one of the supported formats.
108
- Like sidebars, headers affect all pages in their directory and any
109
- subdirectories that do not have a header file of their own.
110
-
111
- ## FOOTER FILES
112
-
113
- Footer files allow you to add a simple footer to your wiki. Footer files must
114
- be named `_Footer.ext` where the extension is one of the supported formats.
115
- Like sidebars, footers affect all pages in their directory and any
116
- subdirectories that do not have a footer file of their own.
117
-
118
- ## HTML SANITIZATION
119
-
120
- For security and compatibility reasons Gollum wikis may not contain custom CSS
121
- or JavaScript. These tags will be stripped from the converted HTML. See
122
- `docs/sanitization.md` for more details on what tags and attributes are
123
- allowed.
124
-
125
- ## TITLES
126
-
127
- The first defined `h1` will override the default header on a page. There are
128
- two ways to set a page title. The metadata syntax:
129
-
130
- <!-- --- title: New Title -->
131
-
132
- The first `h1` tag can be set to always override the page title, without
133
- needing to use the metadata syntax. Start gollum with the `--h1-title` flag.
134
-
135
- ## BRACKET TAGS
136
-
137
- A variety of Gollum tags use a double bracket syntax. For example:
138
-
139
- [[Link]]
140
-
141
- Some tags will accept attributes which are separated by pipe symbols. For
142
- example:
143
-
144
- [[Link|Page Title]]
145
-
146
- In all cases, the first thing in the link is what is displayed on the page.
147
- So, if the tag is an internal wiki link, the first thing in the tag will be
148
- the link text displayed on the page. If the tag is an embedded image, the
149
- first thing in the tag will be a path to an image file. Use this trick to
150
- easily remember which order things should appear in tags.
151
-
152
- Some formats, such as MediaWiki, support the opposite syntax:
153
-
154
- [[Page Title|Link]]
155
-
156
- ## PAGE LINKS
157
-
158
- To link to another Gollum wiki page, use the Gollum Page Link Tag.
159
-
160
- [[Frodo Baggins]]
161
-
162
- The above tag will create a link to the corresponding page file named
163
- `Frodo-Baggins.ext` where `ext` may be any of the allowed extension types. The
164
- conversion is as follows:
165
-
166
- 1. Replace any spaces (U+0020) with dashes (U+002D)
167
- 2. Replace any slashes (U+002F) with dashes (U+002D)
168
-
169
- If you'd like the link text to be something that doesn't map directly to the
170
- page name, you can specify the actual page name after a pipe:
171
-
172
- [[Frodo|Frodo Baggins]]
173
-
174
- The above tag will link to `Frodo-Baggins.ext` using "Frodo" as the link text.
175
-
176
- The page file may exist anywhere in the directory structure of the repository.
177
- Gollum does a breadth first search and uses the first match that it finds.
178
-
179
- Here are a few more examples:
180
-
181
- [[J. R. R. Tolkien]] -> J.-R.-R.-Tolkien.ext
182
- [[Movies / The Hobbit]] -> Movies---The-Hobbit.ext
183
- [[モルドール]] -> モルドール.ext
184
-
185
-
186
- ## EXTERNAL LINKS
187
-
188
- As a convenience, simple external links can be placed within brackets and they
189
- will be linked to the given URL with the URL as the link text. For example:
190
-
191
- [[http://example.com]]
192
-
193
- External links must begin with either "http://" or "https://". If you need
194
- something more flexible, you can resort to the link syntax in the page's
195
- underlying markup format.
196
-
197
-
198
- ## ABSOLUTE VS. RELATIVE VS. EXTERNAL PATH
199
-
200
- For Gollum tags that operate on static files (images, PDFs, etc), the paths
201
- may be referenced as either relative, absolute, or external. Relative paths
202
- point to a static file relative to the page file within the directory
203
- structure of the Gollum repo (even though after conversion, all page files
204
- appear to be top level). These paths are NOT prefixed with a slash. For
205
- example:
206
-
207
- gollum.pdf
208
- docs/diagram.png
209
-
210
- Absolute paths point to a static file relative to the Gollum repo's
211
- root, regardless of where the page file is stored within the directory
212
- structure. These paths ARE prefixed with a slash. For example:
213
-
214
- /pdfs/gollum.pdf
215
- /docs/diagram.png
216
-
217
- External paths are full URLs. An external path must begin with either
218
- "http://" or "https://". For example:
219
-
220
- http://example.com/pdfs/gollum.pdf
221
- http://example.com/images/diagram.png
222
-
223
- All of the examples in this README use relative paths, but you may use
224
- whatever works best in your situation.
225
-
226
-
227
- ## FILE LINKS
228
-
229
- To link to static files that are contained in the Gollum repository you should
230
- use the Gollum File Link Tag.
231
-
232
- [[Gollum|gollum.pdf]]
233
-
234
- The first part of the tag is the link text. The path to the file appears after
235
- the pipe.
236
-
237
-
238
- ## IMAGES
239
-
240
- To display images that are contained in the Gollum repository you should use
241
- the Gollum Image Tag. This will display the actual image on the page.
242
-
243
- [[gollum.png]]
244
-
245
- In addition to the simple format, there are a variety of options that you
246
- can specify between pipe delimiters.
247
-
248
- To specify alt text, use the `alt=` option. Default is no alt text.
249
-
250
- [[gollum.png|alt=Gollum and his precious wiki]]
251
-
252
- To place the image in a frame, use the `frame` option. When combined with the
253
- `alt=` option, the alt text will be used as a caption as well. Default is no
254
- frame.
255
-
256
- [[gollum.png|frame|alt=Gollum and his precious wiki]]
257
-
258
- To specify the alignment of the image on the page, use the `align=` option.
259
- Possible values are `left`, `center`, and `right`. Default is `left`.
260
-
261
- [[gollum.png|align=center]]
262
-
263
- To float an image so that text flows around it, use the `float` option. When
264
- `float` is specified, only `left` and `right` are valid `align` options.
265
- Default is not floating. When floating is activated but no alignment is
266
- specified, default alignment is `left`.
267
-
268
- [[gollum.png|float]]
269
-
270
- By default text will fill up all the space around the image. To control how
271
- much should show up use this tag to stop and start a new block so that
272
- additional content doesn't fill in.
273
-
274
- [[_]]
275
-
276
- To specify a max-width, use the `width=` option. Units must be specified in
277
- either `px` or `em`.
278
-
279
- [[gollum.png|width=400px]]
280
-
281
- To specify a max-height, use the `height=` option. Units must be specified in
282
- either `px` or `em`.
283
-
284
- [[gollum.png|height=300px]]
285
-
286
- Any of these options may be composed together by simply separating them with
287
- pipes.
288
-
289
-
290
- ## ESCAPING GOLLUM TAGS
291
-
292
- If you need the literal text of a wiki or static link to show up in your final
293
- wiki page, simply preface the link with a single quote (like in LISP):
294
-
295
- '[[Page Link]]
296
- '[[File Link|file.pdf]]
297
- '[[image.jpg]]
298
-
299
- This is useful for writing about the link syntax in your wiki pages.
300
-
301
- ## TABLE OF CONTENTS
302
-
303
- Gollum has a special tag to insert a table of contents:
304
-
305
- [[_TOC_]]
306
-
307
- This tag is case sensitive, use all upper case. The TOC tag can be inserted
308
- into the `_Header`, `_Footer` or `_Sidebar` files too.
309
-
310
- There is also a wiki option `:universal_toc` which will display a
311
- table of contents at the top of all your wiki pages if it is enabled:
312
-
313
- ```ruby
314
- Gollum::Wiki.new("my-gollum-repo.git", {:universal_toc => true})
315
- ```
316
-
317
- ## MATHEMATICAL EQUATIONS
318
-
319
- Start gollum with the `--mathjax` flag. Read more about [MathJax](http://docs.mathjax.org/en/latest/index.html) on the web. Gollum uses the `TeX-AMS-MML_HTMLorMML` config with the `autoload-all` extension.
320
-
321
- Inline math:
322
-
323
- - $2^2$
324
- - `\\(2^2\\)`
325
-
326
- Display math:
327
-
328
- - $$2^2$$
329
- - [2^2]
330
-
331
- ## SEQUENCE DIAGRAMS
332
-
333
- You may imbed sequence diagrams into your wiki page (rendered by
334
- [WebSequenceDiagrams](http://www.websequencediagrams.com) by using the
335
- following syntax:
336
-
337
- {{{{{{ blue-modern
338
- alice->bob: Test
339
- bob->alice: Test response
340
- }}}}}}
341
-
342
- You can replace the string "blue-modern" with any supported style.
63
+ Check out the [Gollum Wiki](https://github.com/gollum/gollum/wiki) for all of Gollum's formats and syntactic options.
343
64
 
344
65
  ## API DOCUMENTATION
345
66
 
@@ -383,7 +104,7 @@ page.format
383
104
  # => :markdown
384
105
 
385
106
  vsn = page.version
386
- # => <Grit::Commit>
107
+ # => <Gollum::Git::Commit>
387
108
 
388
109
  vsn.id
389
110
  # => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
@@ -407,7 +128,7 @@ Get a list of versions for a given page:
407
128
 
408
129
  ```ruby
409
130
  vsns = wiki.page('page-name').versions
410
- # => [<Grit::Commit, <Grit::Commit, <Grit::Commit>]
131
+ # => [<Gollum::Git::Commit, <Gollum::Git::Commit, <Gollum::Git::Commit>]
411
132
 
412
133
  vsns.first.id
413
134
  # => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
@@ -432,7 +153,7 @@ file.raw_data
432
153
  # => "alert('hello');"
433
154
 
434
155
  file.version
435
- # => <Grit::Commit>
156
+ # => <Gollum::Git::Commit>
436
157
  ```
437
158
 
438
159
  Get a specific version of a given static file:
@@ -480,28 +201,19 @@ To delete a page and commit the change:
480
201
  wiki.delete_page(page, commit)
481
202
  ```
482
203
 
483
- ## WINDOWS FILENAME VALIDATION
484
-
485
- Note that filenames on windows must not contain any of the following characters `\ / : * ? " < > |`. See [this support article](http://support.microsoft.com/kb/177506) for details.
204
+ Register or unregister a hook to be called after a page commit:
486
205
 
487
- ## CONTRIBUTE
488
-
489
- If you'd like to hack on Gollum-lib, start by forking the repo on GitHub:
206
+ ```ruby
207
+ Gollum::Hook.register(:post_commit, :hook_id) do |committer, sha1|
208
+ # Your code here
209
+ end
490
210
 
491
- http://github.com/gollum/gollum-lib
211
+ Gollum::Hook.unregister(:post_commit, :hook_id)
212
+ ```
492
213
 
493
- To get all of the dependencies, install the gem first. The best way to get
494
- your changes merged back into core is as follows:
214
+ ## WINDOWS FILENAME VALIDATION
495
215
 
496
- 1. Clone down your fork
497
- 1. Create a thoughtfully named topic branch to contain your change
498
- 1. Hack away
499
- 1. Add tests and make sure everything still passes by running `rake`
500
- 1. If you are adding new functionality, document it in the README
501
- 1. Do not change the version number, I will do that on my end
502
- 1. If necessary, rebase your commits into logical chunks, without errors
503
- 1. Push the branch up to GitHub
504
- 1. Send a pull request to the gollum/gollum-lib project.
216
+ Note that filenames on windows must not contain any of the following characters `\ / : * ? " < > |`. See [this support article](http://support.microsoft.com/kb/177506) for details.
505
217
 
506
218
  ## RELEASING
507
219
 
@@ -528,7 +240,7 @@ $ gem uninstall -aIx gollum-lib
528
240
  $ git clone https://github.com/gollum/gollum-lib.git
529
241
  $ cd gollum-lib
530
242
  gollum-lib$ rake build
531
- gollum-lib$ gem install --no-ri --no-rdoc pkg/gollum-lib*.gem
243
+ gollum-lib$ rake install
532
244
  ```
533
245
 
534
246
  ## RUN THE TESTS