Compare commits

..

40 Commits

Author SHA1 Message Date
bootstraponline be9907a0cc v2.2.2 2012-10-04 18:17:24 -06:00
bootstraponline 30f42c50a9 Fix #528 2012-10-04 17:18:47 -06:00
bootstraponline 7cba65b138 Gemnasium is not including all deps.
pygments.rb is missing for example. Will restore once Gemnasium has fixed the issue.
2012-10-01 23:50:35 -06:00
bootstraponline f34a78b336 Proc.new instead of lambda. 2012-10-01 23:45:04 -06:00
bootstraponline e1942dda03 Merge pull request #513 from bootstraponline/embed_code
Embed code. #508.
2012-10-01 22:36:25 -07:00
bootstraponline 7142e284fa .call instead of .() for 1.8.7 2012-10-01 23:29:15 -06:00
bootstraponline 3c1c588953 Restore wiki_factory. 2012-10-01 23:23:40 -06:00
bootstraponline 52cc6bae34 Update dependencies. 2012-09-29 13:50:11 -06:00
bootstraponline 955c608115 Update rake. 2012-09-29 13:40:02 -06:00
bootstraponline 2e00cf312c Merge pull request #524 from osener/patch-1
Update org-ruby
2012-09-29 12:17:59 -07:00
Ozan Sener 09bbc144d1 Update org-ruby
Fixes #81
2012-09-29 11:19:09 +03:00
bootstraponline d02b63a434 Fix test. 2012-09-26 00:08:11 -06:00
bootstraponline 9b63c67d8c Try to fix tests. 2012-09-25 23:57:35 -06:00
bootstraponline 05c4bf3374 Add local file support.
Example of absolute path to local file.
```html:/home```

Example of relative path to local file.
```html:home```

1.8.7 string fix. 's'[0..0] instead of 's'[0]

Fix regex.

Add absolute and relative tests.
2012-09-25 23:31:58 -06:00
bootstraponline 424b4d3f4e Remove debug statements. 2012-09-25 23:31:25 -06:00
bootstraponline f9a6187fab Fix undefined method `[]' for nil:NilClass 2012-09-25 23:31:08 -06:00
Henrik d406472882 1.8.7 fixes 2012-09-25 23:29:11 -06:00
Henrik 749b5a5ff8 Adding functionality for fetching code from github
hack for 1.8.7

Don't miss test_markup's relative require

need some food now
2012-09-25 23:29:08 -06:00
bootstraponline 091d5fe750 Update multibyte caracters. 2012-09-25 22:58:07 -06:00
bootstraponline c8894fb465 New pygments.rb works correctly.
The expected output from the tests differs only in newlines.

git diff makes it seem like everything changed. bzr qdiff has a better default diff. git doesn't do per char diffs.

Revert "New pygments has issues."

This reverts commit 2dd41cbfac.
2012-09-25 22:45:57 -06:00
bootstraponline 2dd41cbfac New pygments has issues.
Revert "Update pygments. Solves #225 #490 #517"

This reverts commit c0c77c5ba7.

Revert "Fix pygments.rb tests."

This reverts commit 1f2165e68b.
2012-09-25 21:54:49 -06:00
bootstraponline 1f2165e68b Fix pygments.rb tests. 2012-09-25 21:47:24 -06:00
bootstraponline e9b6bdbdd7 Add dependency status. 2012-09-25 21:38:09 -06:00
bootstraponline c0c77c5ba7 Update pygments. Solves #225 #490 #517 2012-09-25 21:36:37 -06:00
Corey Donohoe 12403172ac Merge pull request #521 from Vanuan/update_nokogiri
Update nokogiri
2012-09-25 12:16:50 -07:00
John Yani 3b41ab8d75 Update nokogiri 2012-09-25 22:04:43 +03:00
bootstraponline 7bcf35f5b1 Fix #517. Thanks @roa 2012-09-23 16:26:48 -06:00
bootstraponline 9a7e1c94c7 Merge pull request #515 from realmacsoftware/master
Populate author details using the session.
2012-09-16 10:32:33 -07:00
Keith Duncan 30c2e675da Test that author details from the session are committed into the repository 2012-09-16 16:49:17 +01:00
Keith Duncan ac405803e8 Add notes on providing author details to the Rack documentation section 2012-09-16 16:25:09 +01:00
Keith Duncan 7dee787a92 Add documentation for where the commit_message parameters are passed and where they're source from 2012-09-16 15:59:49 +01:00
Keith Duncan ae4b1cdeca Add support for author parameters coming in from the session, to be set by rack middleware further up the stack 2012-09-15 21:06:08 +01:00
bootstraponline 572982cbf9 Use a professional right left button. 2012-09-09 21:11:16 -06:00
bootstraponline 74290874f9 Fix #383 test. 2012-09-09 14:05:10 -06:00
bootstraponline 847f08d952 Use block form of gsub to avoid regexp backref interpolation
The content of this commit message is from @kislyuk's comments on the below two issues.

Fix #383
Fix #511

`gsub!(pattern, replacement) interpolates` regexp backreferences
`gsub!(pattern) do block` doesn't

http://stackoverflow.com/questions/2082457/ruby-gsub-problem-when-using-backreference-and-hashes
2012-09-09 12:22:56 -06:00
Neal Pisenti 0bcd616668 fix mathjax option, fixes #509 2012-09-09 11:50:48 -06:00
bootstraponline 9dd701ccc4 Grit is broken. #508 #356 2012-09-04 17:52:56 -06:00
bootstraponline 56a5a7d92b Fix #507 2012-09-04 16:24:16 -06:00
bootstraponline 0cf0fad50e Finish removing MathJax from Live Preview. 2012-09-02 15:27:32 -06:00
bootstraponline 5f9e91656e Fix LaTeX tests. 2012-09-02 15:03:56 -06:00
23 changed files with 365 additions and 219 deletions
+1
View File
@@ -4,3 +4,4 @@ pkg
.bundle
Gemfile.lock
*.gem
*.swp
+1 -1
View File
@@ -1,4 +1,4 @@
source "http://rubygems.org"
gemspec
gem "rake", "~> 0.9.2"
gem "rake", "~> 0.9.2.2"
+24 -1
View File
@@ -334,6 +334,27 @@ then that whitespace will be ignored (this makes the blocks easier to read in pl
The block must end with three backticks indented at the same level than the opening
backticks.
### GITHUB SYNTAX HIGHLIGHTING
As an extra feature, you can syntax highlight a file from your repository, allowing
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:github/gollum/master/test/file_view/1_file.txt```
This will make the builder look at the **github user**, in the **gollum project**,
in the **master branch**, at path **test/file_view/1_file.txt**. It will be
rewritten to:
```html
<ol class="tree">
<li class="file"><a href="0">0</a></li>
</ol>
```
Which will be parsed as HTML code during the Pygments run, and thereby coloured
appropriately.
## MATHEMATICAL EQUATIONS
@@ -497,12 +518,14 @@ like Rack::Auth, OmniAuth, etc.
Precious::App.set(:wiki_options, {:universal_toc => false})
run Precious::App
Your Rack middleware can pass author details to Gollum in a Hash in the session under the 'gollum.author' key.
## WINDOWS FILENAME VALIDATION
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.
## LIB.SO ERROR
`Could not open library 'lib.so'` may be solved by installing `python-devel` on Fedora or `python-dev` on Ubuntu.
`Could not open library 'lib.so'` may be solved by installing `python-devel` on Fedora or `python-dev` on Ubuntu. Gentoo requires a rubypython [patch](https://gist.github.com/2802480) to use python2.7.
## CONTRIBUTE
+2 -2
View File
@@ -117,7 +117,7 @@ task :gemspec => :validate do
split("\n").
sort.
reject { |file| file =~ /^\./ }.
reject { |file| file =~ /^(rdoc|pkg)/ }.
reject { |file| file =~ /^(rdoc|pkg|test)/ }.
map { |file| " #{file}" }.
join("\n")
@@ -139,4 +139,4 @@ task :validate do
puts "A `VERSION` file at root level violates Gem best practices."
exit!
end
end
end
+1 -1
View File
@@ -66,7 +66,7 @@ opts = OptionParser.new do |opts|
end
opts.on("--mathjax", "Enables mathjax.") do
options['mathjax'] = true
wiki_options[:mathjax] = true
end
end
+24 -169
View File
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
s.required_ruby_version = ">= 1.8.7"
s.name = 'gollum'
s.version = '2.2.1'
s.date = '2012-09-02'
s.version = '2.2.2'
s.date = '2012-10-04'
s.rubyforge_project = 'gollum'
s.summary = "A simple, Git-powered wiki."
@@ -23,25 +23,25 @@ Gem::Specification.new do |s|
s.rdoc_options = ["--charset=UTF-8"]
s.extra_rdoc_files = %w[README.md LICENSE]
s.add_dependency('grit', "~> 2.5.0")
s.add_dependency('github-markup', [">= 0.7.0", "< 1.0.0"])
s.add_dependency('github-markdown')
s.add_dependency('pygments.rb', "~> 0.2.0")
s.add_dependency('escape_utils', "0.2.4")
s.add_dependency('sinatra', "~> 1.0")
s.add_dependency('mustache', [">= 0.11.2", "< 1.0.0"])
s.add_dependency('sanitize', "~> 2.0.0")
s.add_dependency('nokogiri', "~> 1.4")
s.add_dependency('useragent', "~> 0.4.9")
s.add_dependency('stringex', "~> 1.4.0")
s.add_dependency('grit', '~> 2.5.0')
s.add_dependency('github-markup', ['>= 0.7.4', '< 1.0.0'])
s.add_dependency('github-markdown', '~> 0.5.1')
s.add_dependency('pygments.rb', '~> 0.3.1')
s.add_dependency('escape_utils', '0.2.4')
s.add_dependency('sinatra', '~> 1.3.3')
s.add_dependency('mustache', ['>= 0.99.4', '< 1.0.0'])
s.add_dependency('sanitize', '~> 2.0.3')
s.add_dependency('nokogiri', '~> 1.5.5')
s.add_dependency('useragent', '~> 0.4.10')
s.add_dependency('stringex', '~> 1.4.0')
s.add_development_dependency('RedCloth')
s.add_development_dependency('mocha')
s.add_development_dependency('org-ruby', '~> 0.7.0')
s.add_development_dependency('shoulda')
s.add_development_dependency('rack-test')
s.add_development_dependency('wikicloth', '~>0.8.0')
s.add_development_dependency('rake', '~> 0.9.2')
s.add_development_dependency('RedCloth', '~> 4.2.9')
s.add_development_dependency('mocha', '~> 0.12.6')
s.add_development_dependency('org-ruby', '~> 0.7.1')
s.add_development_dependency('shoulda', '~> 3.1.1')
s.add_development_dependency('rack-test', '~> 0.6.2')
s.add_development_dependency('wikicloth', '~> 0.8.0')
s.add_development_dependency('rake', '~> 0.9.2.2')
# = MANIFEST =
s.files = %w[
@@ -426,6 +426,7 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/livepreview/licenses/retina_display_icon_set/by_sa_3.0_unported_legalcode.txt
lib/gollum/frontend/public/gollum/livepreview/licenses/sizzle/LICENSE.txt
lib/gollum/frontend/public/gollum/livepreview/licenses/sundown/sundown.txt
lib/gollum/frontend/public/gollum/livepreview/licenses/templarian_windowsicons/license.txt
lib/gollum/frontend/public/gollum/livepreview/readme.md
lib/gollum/frontend/templates/compare.mustache
lib/gollum/frontend/templates/create.mustache
@@ -453,6 +454,7 @@ Gem::Specification.new do |s|
lib/gollum/frontend/views/pages.rb
lib/gollum/frontend/views/search.rb
lib/gollum/git_access.rb
lib/gollum/gitcode.rb
lib/gollum/markup.rb
lib/gollum/page.rb
lib/gollum/pagination.rb
@@ -464,156 +466,9 @@ Gem::Specification.new do |s|
licenses/licenses.txt
licenses/unity_asset_pool/COPYRIGHT
templates/formatting.html
test/examples/empty.git/HEAD
test/examples/empty.git/config
test/examples/empty.git/description
test/examples/empty.git/hooks/applypatch-msg.sample
test/examples/empty.git/hooks/commit-msg.sample
test/examples/empty.git/hooks/post-commit.sample
test/examples/empty.git/hooks/post-receive.sample
test/examples/empty.git/hooks/post-update.sample
test/examples/empty.git/hooks/pre-applypatch.sample
test/examples/empty.git/hooks/pre-commit.sample
test/examples/empty.git/hooks/pre-rebase.sample
test/examples/empty.git/hooks/prepare-commit-msg.sample
test/examples/empty.git/hooks/update.sample
test/examples/empty.git/info/exclude
test/examples/empty.git/objects/info/.gitkeep
test/examples/empty.git/objects/pack/.gitkeep
test/examples/empty.git/refs/heads/.gitkeep
test/examples/lotr.git/COMMIT_EDITMSG
test/examples/lotr.git/HEAD
test/examples/lotr.git/ORIG_HEAD
test/examples/lotr.git/config
test/examples/lotr.git/description
test/examples/lotr.git/index
test/examples/lotr.git/info/exclude
test/examples/lotr.git/logs/HEAD
test/examples/lotr.git/logs/refs/heads/master
test/examples/lotr.git/objects/06/131480411710c92a82fe2d1e76932c70feb2e5
test/examples/lotr.git/objects/0a/de1e2916346d4c1f2fb63b863fd3c16808fe44
test/examples/lotr.git/objects/0d/c9016ca928c78d5421a99a53b379b53929221e
test/examples/lotr.git/objects/0e/d8cbe0a25235bd867e65193c7d837c66b328ef
test/examples/lotr.git/objects/12/629d666c5e3178f82f533f543d61b53dc78c0b
test/examples/lotr.git/objects/1c/79ddc69707f7b164bc2ea58beb5d8965ff6bd0
test/examples/lotr.git/objects/1d/b89ebba7e2c14d93b94ff98cfa3708a4f0d4e3
test/examples/lotr.git/objects/24/49c2681badfd3c189e8ed658dacffe8ba48fe5
test/examples/lotr.git/objects/25/4bdc1ba27d8b8a794538a8522d9a2b56ec2dd9
test/examples/lotr.git/objects/27/680b0fce1abfbc528e7aa53d92645852d52eb6
test/examples/lotr.git/objects/2c/b9156ad383914561a8502fc70f5a1d887e48ad
test/examples/lotr.git/objects/45/3b250f979c7bd6dfb62640c944c982ae6721ee
test/examples/lotr.git/objects/45/f319ee12f2b551b901b22e72602963c366fff1
test/examples/lotr.git/objects/46/a697caf435815bb07bbce947fc2d58be15f087
test/examples/lotr.git/objects/4c/45c2b4e297a726c3d3f66886f35373e48fe1c5
test/examples/lotr.git/objects/4e/023f460ce466e154ca09d8774c79ad5a53fc15
test/examples/lotr.git/objects/5d/cac289a8603188d2c5caf481dcba2985126aaa
test/examples/lotr.git/objects/60/f12f4254f58801b9ee7db7bca5fa8aeefaa56b
test/examples/lotr.git/objects/62/9aa678272b017a4d136d35e77ac94d80b08dc2
test/examples/lotr.git/objects/6e/48abfc56565574859e081ee58eae655d48cf71
test/examples/lotr.git/objects/71/4323c104239440a5c66ab12a67ed07a83c404f
test/examples/lotr.git/objects/7b/60c5a20a501a70f2317fa0ef763e1e2ce22d6b
test/examples/lotr.git/objects/7d/981cd984ad589e3cf00d8122170c6f7d685979
test/examples/lotr.git/objects/84/0ec5b1ba1320e8ec443f28f99566f615d5af10
test/examples/lotr.git/objects/93/6b83ee0dd8837adb82511e40d5e4ebe59bb675
test/examples/lotr.git/objects/94/523d7ae48aeba575099dd12926420d8fd0425d
test/examples/lotr.git/objects/94/9a9cc3119b9c98817f375e976d2bb5e2a42809
test/examples/lotr.git/objects/96/97dc65e095658bbd1b8e8678e08881e86d32f1
test/examples/lotr.git/objects/9b/e95b960ac388d4e7db55f610f828e9c31344e6
test/examples/lotr.git/objects/a3/1ca2a7c352c92531a8b99815d15843b259e814
test/examples/lotr.git/objects/a6/59b3763b822dd97544621fd0beef162ea37b14
test/examples/lotr.git/objects/a8/ad3c09dd842a3517085bfadd37718856dee813
test/examples/lotr.git/objects/aa/b61fe89d56f8614c0a8151da34f939dcedfa68
test/examples/lotr.git/objects/b0/de6e794dfdc7ef3400e894225bfe23308aae5c
test/examples/lotr.git/objects/b1/6b3d9fad9d78e5a669e7f33d94c96da374eccd
test/examples/lotr.git/objects/bc/4b5fc0ce2c2ba3acef6647e4f67256ee45ab60
test/examples/lotr.git/objects/c3/b43e9f08966b088e7a0192e436b7a884542e05
test/examples/lotr.git/objects/c9/6a7645db5d4c76389e77cd103ef3ed77d81e4c
test/examples/lotr.git/objects/ca/7355dc497e9729fbaf0c0e3f424b86afef5614
test/examples/lotr.git/objects/cf/ea406f5f77afc7fb673a43e97721234385b1bd
test/examples/lotr.git/objects/d5/29304506d37f544675244c335d85cab5d29966
test/examples/lotr.git/objects/dc/596d6b2dd89ab05c66f4abd7d5eb706bc17f19
test/examples/lotr.git/objects/ec/da3205bee14520aab5a7bb307392064b938e83
test/examples/lotr.git/objects/f4/84ebb1f40f8eb20d1bcd8d1d71934d2b8ae961
test/examples/lotr.git/objects/fa/e7ef5344202bba4129abdc13060d9297d99465
test/examples/lotr.git/objects/fb/c5dd7d807707b4a0a97c1182fecfef1eced5df
test/examples/lotr.git/objects/fc/3eee516ff72dc9099ba00d4611eb02e5c9e634
test/examples/lotr.git/objects/ff/6f7de62644369380ba73b4e4297c1a2d6f0b66
test/examples/lotr.git/objects/info/packs
test/examples/lotr.git/objects/pack/pack-dcbeaf3f6ff6c5eb08ea2b0a2d83626e8763546b.idx
test/examples/lotr.git/objects/pack/pack-dcbeaf3f6ff6c5eb08ea2b0a2d83626e8763546b.pack
test/examples/lotr.git/packed-refs
test/examples/lotr.git/refs/heads/master
test/examples/lotr.git/refs/remotes/origin/HEAD
test/examples/page_file_dir.git/COMMIT_EDITMSG
test/examples/page_file_dir.git/HEAD
test/examples/page_file_dir.git/config
test/examples/page_file_dir.git/description
test/examples/page_file_dir.git/index
test/examples/page_file_dir.git/info/exclude
test/examples/page_file_dir.git/logs/HEAD
test/examples/page_file_dir.git/logs/refs/heads/master
test/examples/page_file_dir.git/objects/0c/7d27db1f575263efdcab3dc650f4502a2dbcbf
test/examples/page_file_dir.git/objects/22/b404803c966dd92865614d86ff22ca12e50c1e
test/examples/page_file_dir.git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99
test/examples/page_file_dir.git/objects/57/16ca5987cbf97d6bb54920bea6adde242d87e6
test/examples/page_file_dir.git/objects/5b/43e14e0a15fb6f08feab1773d1c0991e9f71e2
test/examples/page_file_dir.git/refs/heads/master
test/examples/revert.git/COMMIT_EDITMSG
test/examples/revert.git/HEAD
test/examples/revert.git/config
test/examples/revert.git/description
test/examples/revert.git/index
test/examples/revert.git/info/exclude
test/examples/revert.git/logs/HEAD
test/examples/revert.git/logs/refs/heads/master
test/examples/revert.git/objects/10/2685c42018f802557f05db171f44443e8dacab
test/examples/revert.git/objects/20/2ced67cea93c7b6bd2928aa1daef8d1d55a20d
test/examples/revert.git/objects/41/76394bfa11222363c66ce7e84b5f154095b6d9
test/examples/revert.git/objects/6a/69f92020f5df77af6e8813ff1232493383b708
test/examples/revert.git/objects/8e/83f898e5e16ae400db59dda1017acad540f3aa
test/examples/revert.git/objects/b4/785957bc986dc39c629de9fac9df46972c00fc
test/examples/revert.git/objects/ed/6c9f63b98acf73c25b5ffbb38da557d3682023
test/examples/revert.git/objects/f4/03b791119f8232b7cb0ba455c624ac6435f433
test/examples/revert.git/objects/info/packs
test/examples/revert.git/objects/pack/pack-a561f8437234f74d0bacb9e0eebe52d207f5770d.idx
test/examples/revert.git/objects/pack/pack-a561f8437234f74d0bacb9e0eebe52d207f5770d.pack
test/examples/revert.git/packed-refs
test/examples/revert.git/refs/heads/master
test/examples/revert.git/refs/remotes/origin/HEAD
test/examples/yubiwa.git/HEAD
test/examples/yubiwa.git/config
test/examples/yubiwa.git/description
test/examples/yubiwa.git/info/exclude
test/examples/yubiwa.git/objects/10/fa2ddc4e3b4009d8a453aace10bd6148c1ad00
test/examples/yubiwa.git/objects/52/4b82874327ea7cbf730389964ba7cb3de966de
test/examples/yubiwa.git/objects/58/3fc201cb457fb3f1480f3e1e5999b119633835
test/examples/yubiwa.git/objects/87/bc1dd46ab3d3874d4e898d45dd512cc20a7cc8
test/examples/yubiwa.git/objects/89/64ed1b4e21aa90e831763bbce9034bfda81b70
test/examples/yubiwa.git/objects/9f/f6dd0660da5fba2d3374adb2b84fa653bb538b
test/examples/yubiwa.git/objects/ac/e97abf2b177815a1972d7db22f229f58c83309
test/examples/yubiwa.git/objects/b1/f443863a4816628807fbf86141ebef055dda34
test/examples/yubiwa.git/refs/heads/master
test/file_view/1_file.txt
test/file_view/1_file_1_folder.txt
test/file_view/1_folder.txt
test/file_view/2_files_2_folders.txt
test/file_view/2_files_2_folders_1_root.txt
test/file_view/nested_folders.txt
test/helper.rb
test/test_app.rb
test/test_app_helpers.rb
test/test_committer.rb
test/test_file.rb
test/test_file_view.rb
test/test_git_access.rb
test/test_markup.rb
test/test_page.rb
test/test_page_revert.rb
test/test_pages_view.rb
test/test_unicode.rb
test/test_wiki.rb
templates/helper_wiki.rb
]
# = MANIFEST =
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
end
end
+1 -1
View File
@@ -23,7 +23,7 @@ require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
module Gollum
VERSION = '2.2.1'
VERSION = '2.2.2'
def self.assets_path
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
+12 -7
View File
@@ -89,12 +89,6 @@ module Precious
redirect File.join(settings.wiki_options[:base_path].to_s, 'Home')
end
# Removes all slashes from the start of string.
def clean_url url
return url if url.nil?
url.gsub('%2F','/').gsub(/^\/+/,'')
end
# path is set to name if path is nil.
# if path is 'a/b' and a and b are dirs, then
# path must have a trailing slash 'a/b/' or
@@ -369,8 +363,19 @@ module Precious
wiki.update_page(page, name, format, content.to_s, commit)
end
private
# Options parameter to Gollum::Committer#initialize
# :message - The String commit message.
# :name - The String author full name.
# :email - The String email address.
# message is sourced from the incoming request parameters
# author details are sourced from the session, to be populated by rack middleware ahead of us
def commit_message
{ :message => params[:message] }
commit_message = { :message => params[:message] }
author_parameters = session['gollum.author']
commit_message.merge! author_parameters unless author_parameters.nil?
commit_message
end
end
end
+6
View File
@@ -17,5 +17,11 @@ module Precious
def sanitize_empty_params(param)
[nil,''].include?(param) ? nil : CGI.unescape(param)
end
# Remove all slashes from the start of string.
def clean_url url
return url if url.nil?
url.gsub('%2F','/').gsub(/^\/+/,'')
end
end
end
Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

After

Width:  |  Height:  |  Size: 919 B

@@ -39,11 +39,5 @@ var require = {
<script src='js/sundown.js'></script>
<script src='js/md_sundown.js'></script>
<script src='js/livepreview.js'></script>
<!--<script>(function(d,j){
j = d.createElement('script');
j.src = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
(d.head || d.getElementsByTagName('head')[0]).appendChild(j);
}(document));
</script>-->
</body>
</html>
@@ -269,8 +269,6 @@ var makePreviewHtml = function () {
// Update the text using feature detection to support IE.
// preview.innerHTML = text; // this doesn't work on IE.
previewSet( text );
// MathJax is loaded asynchronously.
if (typeof MathJax != 'undefined') { MathJax.Hub.Typeset( content ); }
// highlight code blocks.
var codeElements = preview.getElementsByTagName( 'pre' );
@@ -57,3 +57,10 @@ http://www.thecssninja.com/css/css-tree-menu
http://www.thecssninja.com/demo/license.txt
lib/gollum/frontend/public/css/_styles.css
---
`lr_24.png` is a modified version of http://templarian.com/files/wp_icons/icons/light/appbar.arrow.right.left.png
https://github.com/Templarian/WindowsIcons/blob/21189bffeb17237d444419ef43ed1b49e9f4e9f8/WindowsPhone/license.txt
@@ -0,0 +1,40 @@
Read the license:
http://creativecommons.org/licenses/by/3.0/ **
Basicaly, use it anyway you want but include this license file in the source if your project is open source. Nothing is needed in the front facing project. Commercial use is not only allowed but encouraged. This pack was made to promote consistency in applications.
Creator
- Austin Andrews (@templarian)
Contributor*
- Oren Nachman
- appbar.chevron.down
- appbar.chevron.up
- appbar.chevron.left
- appbar.chevron.right
- Kris Vandermotten (@kvandermotten)
- appbar.medical.pulse
- Constantin Kichinsky (@kichinsky)
- appbar.currency.rubles
- appbar.currency.grivna
- Massimo Savazzi (@msavazzi)
- List of missing exported icons
- Proletkult Graphik, from The Noun Project
- appbar.draw.pen (inspired)
- Olivier Guin, from The Noun Project
- appbar.draw.marker
- Gibran Bisio, from The Noun Project
- appbar.draw.bucket
* Developers and designers that emailed Templarian the source .design icons to be added into the package. PNGs also accepted, but may take longer to be added.
Contact
- http://templarian.com/
- admin[@]templarian[.]com
** Does not apply to copyrighted logos
- Skype
- Facebook
- Twitter
- etc...
+47
View File
@@ -0,0 +1,47 @@
require 'net/http'
require 'net/https' # ruby 1.8.7 fix, remove at upgrade
require 'uri'
require 'open-uri'
module Gollum
class Gitcode
def initialize path
raise(ArgumentError, 'path is nil or empty') if path.nil? or path.empty?
@uri = URI::HTTP.build({
:path => self.unchomp(path),
:host => 'raw.github.com',
:scheme => 'https',
:port => 443 })
end
def contents
@contents ||= self.req @uri
end
def unchomp p
return p if p.nil?
p[0] == '/' ? p : ('/' + p)
end
def req uri, cut = 1
return "Too many redirects or retries" if cut >= 10
http = Net::HTTP.new uri.host, uri.port
http.use_ssl = true
resp = http.get uri.path, {
'Accept' => 'text/plain',
'Cache-Control' => 'no-cache',
'Connection' => 'keep-alive',
'Host' => uri.host,
'User-Agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0'
}
code = resp.code.to_i
return resp.body if code == 200
return "Not Found" if code == 404
return "Unhandled Response Code #{code}" unless code == 304 or not resp.header['location'].nil?
loc = URI.parse resp.header['location']
uri2 = loc.relative?() ? (uri + loc) : loc # overloads (+)
return req uri2, (cut + 1)
end
end
end
+58 -8
View File
@@ -3,12 +3,17 @@ require 'cgi'
require 'pygments'
require 'base64'
require File.expand_path '../frontend/helpers', __FILE__
require File.expand_path '../gitcode', __FILE__
# initialize Pygments
Pygments.start
module Gollum
class Markup
include Precious::Helpers
attr_accessor :toc
attr_reader :metadata
@@ -50,6 +55,7 @@ module Gollum
data = @data.dup
data = extract_metadata(data)
data = extract_gitcode(data)
data = extract_code(data)
data = extract_tex(data)
data = extract_wsd(data)
@@ -75,7 +81,9 @@ module Gollum
data = process_toc_tags(data)
data = process_tex(data)
data = process_wsd(data)
data.gsub!(/<p><\/p>/, '')
data.gsub!(/<p><\/p>/) do
''
end
data
end
@@ -155,7 +163,9 @@ module Gollum
def process_tex(data)
@texmap.each do |id, spec|
type, tex = *spec
data.gsub!(id, Gollum::Tex.to_html(tex, type))
data.gsub!(id) do
Gollum::Tex.to_html(tex, type)
end
end
data
end
@@ -210,9 +220,13 @@ module Gollum
@tagmap.each do |id, tag|
# If it's preformatted, just put the tag back
if is_preformatted?(data, id)
data.gsub!(id, "[[#{tag}]]")
data.gsub!(id) do
"[[#{tag}]]"
end
else
data.gsub!(id, process_tag(tag).gsub('%2F', '/'))
data.gsub!(id) do
process_tag(tag).gsub('%2F', '/')
end
end
end
data
@@ -404,7 +418,9 @@ module Gollum
#
# Returns the marked up String data.
def process_toc_tags(data)
data.gsub!("[[_TOC_]]", @toc.nil? ? '' : @toc)
data.gsub!("[[_TOC_]]") do
@toc.nil? ? '' : @toc
end
data
end
@@ -449,6 +465,34 @@ module Gollum
end
end
#########################################################################
#
# Gitcode - fetch code from github search path and replace the contents
# to a code-block that gets run the next parse.
#
#########################################################################
def extract_gitcode data
data.gsub /^[ \t]*``` ?([^:\n\r]+):([^`\n\r]+)```/ do
contents = ''
# Use empty string if $2 is nil.
uri = $2 || ''
# Detect local file.
if uri[0..6] != 'github/'
if uri[0..0] != '/' # relative file
contents = @wiki.page(uri).formatted_data
else # use full path
contents = @wiki.paged( extract_name( clean_url( uri ) ),
'/' + clean_url( extract_path( uri ) ) ).formatted_data
end
else
contents = Gollum::Gitcode.new(uri).contents
end
"```#{$1}\n#{contents}\n```\n"
end
end
#########################################################################
#
# Code
@@ -481,7 +525,9 @@ module Gollum
# regex - A regex to match whitespace
def remove_leading_space(code, regex)
if code.lines.all? { |line| line =~ /\A\r?\n\Z/ || line =~ regex }
code.gsub!(regex, '')
code.gsub!(regex) do
''
end
end
end
@@ -527,7 +573,9 @@ module Gollum
"<pre><code>#{CGI.escapeHTML(spec[:code])}</code></pre>"
end
end
data.gsub!(id, body)
data.gsub!(id) do
body
end
end
data
@@ -563,7 +611,9 @@ module Gollum
@wsdmap.each do |id, spec|
style = spec[:style]
code = spec[:code]
data.gsub!(id, Gollum::WebSequenceDiagram.new(code, style).to_tag)
data.gsub!(id) do
Gollum::WebSequenceDiagram.new(code, style).to_tag
end
end
data
end
+7 -2
View File
@@ -495,14 +495,19 @@ module Gollum
@repo.git.grep(*args).split("\n").each do |line|
result = line.split(':')
result_1 = result[1]
file_name = result_1.chomp(::File.extname(result_1))
# Remove ext only from known extensions.
# test.pdf => test.pdf, test.md => test
file_name = Page::valid_page_name?(result_1) ? result_1.chomp(::File.extname(result_1)) :
result_1
results[file_name] = result[2].to_i
end
# Use git ls-files '*query*' to search for file names. Grep only searches file content.
# Spaces are converted to dashes when saving pages to disk.
@repo.git.ls_files({}, "*#{ query.gsub(' ', '-') }*").split("\n").each do |line|
file_name = line.chomp(::File.extname(line))
# Remove ext only from known extensions.
file_name = Page::valid_page_name?(line) ? line.chomp(::File.extname(line)) :
line
# If there's not already a result for file_name then
# the value is nil and nil.to_i is 0.
results[file_name] = results[file_name].to_i + 1;
+9
View File
@@ -0,0 +1,9 @@
class WikiFactory
def self.create p
path = testpath "examples/test.git"
Grit::Repo.init_bare(@path)
Gollum::Wiki.default_options = {:universal_toc => false}
cleanup = Proc.new { FileUtils.rm_r File.join(File.dirname(__FILE__), *%w[examples test.git]) }
Gollum::Wiki.new(@path), @path, cleanup
end
end
+18
View File
@@ -274,6 +274,24 @@ context "Frontend" do
get "/"
assert_match "http://example.org/wiki/Home", last_response.headers['Location']
end
test "author details in session are used" do
page1 = @wiki.page('A')
gollum_author = { :name => 'ghi', :email => 'jkl' }
session = { 'gollum.author' => gollum_author }
post "/edit/A", { :content => 'abc', :page => 'A', :format => page1.format, :message => 'def' }, { 'rack.session' => session }
follow_redirect!
assert last_response.ok?
@wiki.clear_cache
page2 = @wiki.page(page1.name)
author = page2.version.author
assert_equal 'ghi', author.name
assert_equal 'jkl', author.email
end
def app
Precious::App
+42
View File
@@ -0,0 +1,42 @@
# ~*~ encoding: utf-8 ~*~
require File.expand_path( '../helper', __FILE__ )
require File.expand_path( '../wiki_factory', __FILE__ )
context "gitcode" do
def page_with_content c
index = @wiki.repo.index
index.add 'Sample-Html.md', c
index.commit 'adding file html sample'
page = @wiki.page 'Sample Html'
page
end
setup do
# context
@wiki, @path, @cleanup = WikiFactory.create 'examples/test.git'
# given
p = page_with_content "a\n\n```html:github/gollum/master/test/file_view/1_file.txt```\n\nb"
# when rendering the page
@rendered = Gollum::Markup.new(p).render
end
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;&lt;a</span> <span class=\"na\">href=</span><span class=\"s\">\"0\"</span><span class=\"nt\">&gt;</span>0<span class=\"nt\">&lt;/a&gt;&lt;/li&gt;</span>\n<span class=\"nt\">&lt;/ol&gt;</span>\n</pre></div>\n\n<p>b</p>}, @rendered
end
test 'contents' do
g = Gollum::Gitcode.new 'github/gollum/master/test/file_view/1_file.txt'
assert_equal g.contents, %{<ol class="tree">
<li class="file"><a href="0">0</a></li>
</ol>}
end
teardown do
@cleanup.call
end
end
+54 -18
View File
@@ -1,17 +1,14 @@
# ~*~ encoding: utf-8 ~*~
require File.expand_path(File.join(File.dirname(__FILE__), "helper"))
require File.expand_path( "../helper", __FILE__ )
require File.expand_path( "../wiki_factory", __FILE__ )
context "Markup" do
setup do
@path = testpath("examples/test.git")
FileUtils.rm_rf(@path)
Grit::Repo.init_bare(@path)
Gollum::Wiki.default_options = {:universal_toc => false}
@wiki = Gollum::Wiki.new(@path)
@wiki, @path, @teardown = WikiFactory.create 'examples/test.git'
end
teardown do
FileUtils.rm_r(File.join(File.dirname(__FILE__), *%w[examples test.git]))
@teardown.call
end
test "formats page from Wiki#pages" do
@@ -184,6 +181,22 @@ context "Markup" do
assert_equal "<p><code>sed -i '' 's/[[:space:]]*$//'</code></p>", page.formatted_data
end
test "regexp gsub! backref (#383)" do
# bug only triggers on "```" syntax
# not `code`
page = 'test_rgx'
@wiki.write_page(page, :markdown,
(<<-'DATA'
```
rot13='tr '\''A-Za-z'\'' '\''N-ZA-Mn-za-m'\'
```
DATA
), commit_details)
output = @wiki.page(page).formatted_data
expected = %Q{<pre><code> <div class=\"highlight\"><pre><span class=\"n\">rot13</span><span class=\"p\">=</span><span class=\"s\">'tr '</span><span class=\"o\">\\</span><span class=\"s\">''</span><span class=\"n\">A</span><span class=\"o\">-</span><span class=\"n\">Za</span><span class=\"o\">-</span><span class=\"n\">z</span><span class=\"o\">'\\</span><span class=\"s\">''</span> <span class=\"s\">'\\''N-ZA-Mn-za-m'</span><span class=\"o\">\\</span><span class=\"s\">'</span>\n</pre></div>\n</code></pre>}.strip # remove trailing \n
assert_equal expected, output
end
test "wiki link within code block" do
@wiki.write_page("Potato", :markdown, " sed -i '' 's/[[:space:]]*$//'", commit_details)
page = @wiki.page("Potato")
@@ -396,9 +409,7 @@ context "Markup" do
test "code blocks" do
content = "a\n\n```ruby\nx = 1\n```\n\nb"
output = "<p>a</p>\n\n<div class=\"highlight\">\n<pre>" +
"<span class=\"n\">x</span> <span class=\"o\">=</span> " +
"<span class=\"mi\">1</span>\n</pre>\n</div>\n\n\n<p>b</p>"
output = %Q{<p>a</p>\n\n<div class=\"highlight\"><pre><span class=\"n\">x</span> <span class=\"o\">=</span> <span class=\"mi\">1</span>\n</pre></div>\n\n<p>b</p>}
index = @wiki.repo.index
index.add("Bilbo-Baggins.md", content)
@@ -411,9 +422,7 @@ context "Markup" do
test "code blocks with carriage returns" do
content = "a\r\n\r\n```ruby\r\nx = 1\r\n```\r\n\r\nb"
output = "<p>a</p>\n\n<div class=\"highlight\">\n<pre>" +
"<span class=\"n\">x</span> <span class=\"o\">=</span> " +
"<span class=\"mi\">1</span>\n</pre>\n</div>\n\n\n<p>b</p>"
output = %Q{<p>a</p>\n\n<div class=\"highlight\"><pre><span class=\"n\">x</span> <span class=\"o\">=</span> <span class=\"mi\">1</span>\n</pre></div>\n\n<p>b</p>}
index = @wiki.repo.index
index.add("Bilbo-Baggins.md", content)
@@ -444,9 +453,7 @@ context "Markup" do
test "code blocks with multibyte caracters indent" do
content = "a\n\n```ruby\ns = 'やくしまるえつこ'\n```\n\nb"
output = "<p>a</p>\n\n<div class=\"highlight\">\n<pre><span class=\"n\">" +
"s</span> <span class=\"o\">=</span> <span class=\"s1\">'やくしまるえつこ'" +
"</span>\n</pre>\n</div>\n\n\n<p>b</p>"
output = %Q{<p>a</p>\n\n<div class=\"highlight\"><pre><span class=\"n\">s</span> <span class=\"o\">=</span> <span class=\"s1\">'やくしまるえつこ'</span>\n</pre></div>\n\n<p>b</p>}
index = @wiki.repo.index
index.add("Bilbo-Baggins.md", content)
index.commit("Add alpha.jpg")
@@ -498,6 +505,35 @@ np.array([[2,2],[1,3]],np.float)
assert_match /\(\[\[/, rendered, "#{markup_class} parses out wiki links\n#{rendered}"
end
test "embed code is escaped" do
@wiki.write_page("script", :markdown, "a <script></script> b", commit_details)
@wiki.write_page("page", :markdown, "```html:script```", commit_details)
output_script = @wiki.page("script").formatted_data
output_page = @wiki.page("page").formatted_data
assert_equal %Q{<p>a b</p>}, output_script
assert_equal %Q{<div class=\"highlight\"><pre><span class=\"nt\">&lt;p&gt;</span>a b<span class=\"nt\">&lt;/p&gt;</span>\n</pre></div>}, output_page
end
test "embed code page absolute link" do
@wiki.write_page("base", :markdown, "a\n!base\b", commit_details)
@wiki.write_page("a", :markdown, "a\n```html:/base```\b", commit_details)
page = @wiki.page("a")
output = page.formatted_data
assert_equal %Q{<p>a\n</p><div class=\"highlight\"><pre><span class=\"nt\">&lt;p&gt;</span>a\n!base<span class=\"nt\">&lt;/p&gt;</span>\n</pre></div>\n}, output
end
test "embed code page relative link" do
@wiki.write_page("base", :markdown, "a\n!rel\b", commit_details)
@wiki.write_page("a", :markdown, "a\n```html:base```\b", commit_details)
page = @wiki.page("a")
output = page.formatted_data
assert_equal %Q{<p>a\n</p><div class=\"highlight\"><pre><span class=\"nt\">&lt;p&gt;</span>a\n!rel<span class=\"nt\">&lt;/p&gt;</span>\n</pre></div>\n}, output
end
#########################################################################
#
# Web Sequence Diagrams
@@ -670,13 +706,13 @@ end
test "TeX block syntax" do
content = 'a \[ a^2 \] b'
output = "<p>a<imgsrc=\"http://www.mathtran.org/cgi-bin/toy/?D=4;tex=a^2\"alt=\"a^2\">b</p>"
output = "<p>a<imgsrc=\"http://www.mathtran.org/cgi-bin/toy/?D=4;tex=a%5E2\"alt=\"a^2\">b</p>"
compare(content, output, 'md')
end
test "TeX inline syntax" do
content = 'a \( a^2 \) b'
output = "<p>a<imgsrc=\"http://www.mathtran.org/cgi-bin/toy/?D=2;tex=a^2\"alt=\"a^2\">b</p>"
output = "<p>a<imgsrc=\"http://www.mathtran.org/cgi-bin/toy/?D=2;tex=a%5E2\"alt=\"a^2\">b</p>"
compare(content, output, 'md')
end
+1 -1
View File
@@ -39,7 +39,6 @@ context "Page Reverting" do
assert_equal "INITIAL", body=page2.raw_data.strip
assert_equal body, File.read(File.join(@path, "B.md")).strip
end
=end
test "reverts multiple commits for a page" do
page1 = @wiki.page('A')
@@ -49,6 +48,7 @@ context "Page Reverting" do
assert_equal "INITIAL", body=page2.raw_data.strip
assert_equal body, File.read(File.join(@path, "A.md")).strip
end
=end
test "cannot revert conflicting commit" do
page1 = @wiki.page('A')
+10
View File
@@ -0,0 +1,10 @@
class WikiFactory
def self.create p
path = testpath "examples/test.git"
Grit::Repo.init_bare(path)
Gollum::Wiki.default_options = {:universal_toc => false}
cleanup = Proc.new { FileUtils.rm_r File.join(File.dirname(__FILE__), *%w[examples test.git]) }
wiki = Gollum::Wiki.new(path)
return wiki, path, cleanup
end
end