Skip to content
Snippets Groups Projects
Commit 24da3a91 authored by Jamie Oliver's avatar Jamie Oliver
Browse files

Merge remote-tracking branch 'gollum/master'

Conflicts:
	bin/gollum
	lib/gollum-lib/markup.rb
	lib/gollum/frontend/app.rb
	lib/gollum/frontend/templates/file_view.mustache
	lib/gollum/frontend/templates/layout.mustache
	lib/gollum/frontend/views/layout.rb
	test/test_app.rb
parents aca67101 54e14456
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -25,6 +25,11 @@ Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses
- Unix like operating system (OS X, Ubuntu, Debian, and more)
- Will not work on Windows (because of [grit](https://github.com/github/grit))
 
## SECURITY
Don't enable `--custom-css` or `--custom-js` unless you trust every user who has the ability to edit the wiki.
A better solution with more security is being tracked in [#665](https://github.com/gollum/gollum/issues/665).
## INSTALLATION
 
The best way to install Gollum is with RubyGems:
Loading
Loading
@@ -364,9 +369,9 @@ As an extra feature, you can syntax highlight a file from your repository, allow
you keep some of your sample code in the main repository. The code-snippet is
updated when the wiki is rebuilt. You include github code like this:
 
```html:gollum/gollum/master/test/file_view/1_file.txt```
```html:github:gollum/gollum/master/test/file_view/1_file.txt```
 
This will make the builder look at the **github user**, in the **gollum project**,
This will make the builder look at the **gollum user**, in the **gollum project**,
in the **master branch**, at path **test/file_view/1_file.txt**. It will be
rewritten to:
 
Loading
Loading
@@ -554,10 +559,12 @@ Note that filenames on windows must not contain any of the following characters
 
Gollum optionally takes a `--config file`. See [config.rb](https://github.com/gollum/gollum/blob/master/config.rb) for an example.
 
## CUSTOM CSS
## CUSTOM CSS/JS
 
The `--css` flag will inject `custom.css` from the root of your git repository into each page. `custom.css` must be commited to git or you will get a 302 redirect to the create page.
 
The `--js` flag will inject `custom.js` from the root of your git repository into each page. `custom.js` must be commited to git or you will get a 302 redirect to the create page.
## CONTRIBUTE
 
If you'd like to hack on Gollum, start by forking the repo on GitHub:
Loading
Loading
Loading
Loading
@@ -462,15 +462,15 @@ module Gollum
# Acceptable formats:
# ```language:local-file.ext```
# ```language:/abs/other-file.ext```
# ```language:gollum/gollum/master/somefile.txt```
# ```language:github:gollum/gollum/master/somefile.txt```
#
#########################################################################
 
def extract_gitcode data
data.gsub /^[ \t]*``` ?([^:\n\r]+):([^`\n\r]+)```/ do
data.gsub /^[ \t]*``` ?([^:\n\r]+):(?:(github:))?([^`\n\r]+)```/ do
contents = ''
# Use empty string if $2 is nil.
uri = $2 || ''
uri = $3 || ''
# Detect local file.
if uri[0..6] != 'gollum/'
if file = self.find_file(uri, @wiki.ref)
Loading
Loading
Loading
Loading
@@ -16,16 +16,18 @@ context "gitcode" do
setup do
# context
@wiki, @path, @cleanup = WikiFactory.create 'examples/test.git'
end
 
test 'that the rendered output is correctly fetched and rendered as html code' do
# given
p = page_with_content "a\n\n```html:gollum/gollum/master/test/file_view/1_file.txt```\n\nb"
p = page_with_content "a\n\n```html:github:gollum/gollum/master/test/file_view/1_file.txt```\n\nb"
 
# when rendering the page
@rendered = Gollum::Markup.new(p).render
end
rendered = Gollum::Markup.new(p).render
 
test 'that the rendered output is correctly fetched and rendered as html code' do
assert_equal %Q{<p>a</p>\n\n<div class=\"highlight\"><pre><span class=\"nt\">&lt;ol</span> <span class=\"na\">class=</span><span class=\"s\">\"tree\"</span><span class=\"nt\">&gt;</span>\n <span class=\"nt\">&lt;li</span> <span class=\"na\">class=</span><span class=\"s\">\"file\"</span><span class=\"nt\">&gt;</span>\n <span class=\"nt\">&lt;a</span> <span class=\"na\">href=</span><span class=\"s\">\"0\"</span><span class=\"nt\">&gt;&lt;span</span> <span class=\"na\">class=</span><span class=\"s\">\"icon\"</span><span class=\"nt\">&gt;&lt;/span&gt;</span>0<span class=\"nt\">&lt;/a&gt;</span>\n <span class=\"nt\">&lt;/li&gt;</span>\n<span class=\"nt\">&lt;/ol&gt;</span>\n</pre></div>\n\n<p>b</p>}, @rendered
# we expect
expected = %Q{<p>a</p>\n\n<div class=\"highlight\"><pre><span class=\"nt\">&lt;ol</span> <span class=\"na\">class=</span><span class=\"s\">\"tree\"</span><span class=\"nt\">&gt;</span>\n <span class=\"nt\">&lt;li</span> <span class=\"na\">class=</span><span class=\"s\">\"file\"</span><span class=\"nt\">&gt;</span>\n <span class=\"nt\">&lt;a</span> <span class=\"na\">href=</span><span class=\"s\">\"0\"</span><span class=\"nt\">&gt;&lt;span</span> <span class=\"na\">class=</span><span class=\"s\">\"icon\"</span><span class=\"nt\">&gt;&lt;/span&gt;</span>0<span class=\"nt\">&lt;/a&gt;</span>\n <span class=\"nt\">&lt;/li&gt;</span>\n<span class=\"nt\">&lt;/ol&gt;</span>\n</pre></div>\n\n<p>b</p>}
assert_equal expected, rendered
end
 
test 'contents' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment