Compare commits

..

44 Commits

Author SHA1 Message Date
Dawa Ometto ece5c775f1 Release 4.1.0 2017-03-09 17:34:37 +01:00
Dawa Ometto 3121c43b71 Merge pull request #1180 from bogado/issue#1179
Fix page list for files that have regexp special chars.
2017-03-09 16:22:40 +01:00
Bart Kamphorst 51e8caf369 Merge pull request #1191 from polyzen/patch-1
readme: Use --document in place of deprecated options
2017-02-16 16:05:35 +01:00
Daniel M. Capella e7e7937678 readme: Use --document in place of deprecated options 2017-02-02 14:26:32 -05:00
Dawa Ometto 00dfecb1c7 Merge pull request #1185 from connorshea/ruby-24
Test on Ruby 2.4
2017-01-20 23:30:24 +01:00
Dawa Ometto cc249bef15 Merge pull request #1182 from bjoernalbers/master
Add another video to README.
2017-01-19 15:14:11 +01:00
Connor Shea 9a2231804d Test on Ruby 2.4 2017-01-14 19:10:17 -05:00
Björn Albers 1edcf15bcd Add another video to README. 2017-01-10 18:26:56 +01:00
Victor Bogado 0190e08763 Fix page list for files that have regexp special chars.
The page list collection logic was using the filename without any
scaping to create a regexp. This not only breaks for some names it might
even be a security problem by introducing bad regular expression as
filenames.
2017-01-01 19:55:18 -08:00
Dawa Ometto d3cc5a69c4 Merge branch 'rc' 2016-08-07 21:36:51 +02:00
Dawa Ometto 07ca53a778 Merge branch 'rc' into master
Conflicts:
	bin/gollum
2016-08-07 21:36:13 +02:00
Dawa Ometto 6910b6d024 Merge pull request #1143 from astorije/patch-1
Fix compare page not accessible in no-edit mode. Resolves #1140.
2016-08-07 20:17:34 +02:00
Bart Kamphorst f02c934ad7 Merge pull request #1154 from maarten/#855-delete-files
Fixes #855 Adds file deletion fuctionality.
2016-08-07 19:46:55 +02:00
Maarten Engelen 236680aab9 Add file deletion functionality
Adds route for file deletion
Add styles and images for this
2016-08-07 17:18:36 +02:00
Dawa Ometto 6316f97c06 Update CONTRIBUTING.md 2016-08-07 12:50:48 +02:00
Dawa Ometto 14830af306 Update CONTRIBUTING.md 2016-08-07 12:50:18 +02:00
Dawa Ometto b620decde7 Add contributing guidelines 2016-08-07 12:48:07 +02:00
Bart Kamphorst b08ca620a0 Merge pull request #1148 from astorije/patch-2
Remove deprecated github-markdown markup
2016-07-11 21:44:02 +02:00
Jérémie Astori 66a2bb0393 Remove deprecated github-markdown markup
From [RubyGems](https://rubygems.org/gems/github-markdown/versions/0.6.9):

> THIS GEM IS NOT MAINTAINED AND NOT SUPPORTED.

Also, the GitHub repository, maintained by GitHub, was removed.

The link is now a redirect, it doesn't point to the GFM page anymore.
2016-07-11 12:19:43 -04:00
Jérémie Astori 0675844d97 Fix compare page not accessible in no-edit mode
Permission checking was spread across `post` action handlers instead of inside the `before` to normalize between `get` and `post` action handlers and be more explicit.
2016-06-27 13:50:47 -04:00
Dawa Ometto 148eda2990 Merge pull request #1136 from gollum/503-safari-live
Add Safari to livepreview-enabled browsers. Fixes #503
2016-06-16 13:28:46 +02:00
Dawa Ometto 330f7b4002 Add Safari to livepreview-enabled browsers. Fixes #503 2016-06-16 12:58:22 +02:00
Dawa Ometto def0fc8866 Merge pull request #1126 from svoop/emoji
Support for emoji
2016-06-09 16:43:52 +02:00
Sven Schwyn fa1bcf9608 Add support for emojione 2016-05-19 20:33:25 +02:00
Bart Kamphorst 5a5e56a47b Merge pull request #1111 from jhominal/master
Unconditionally add 'test-unit' dependency.
2016-02-24 02:28:24 +01:00
Jean Hominal e64f40eaa3 Unconditionally add 'test-unit' dependency.
Fixes #1110
2016-02-23 22:52:07 +01:00
Dawa Ometto 3f3d86ad4c Merge pull request #1091 from jhominal/master
Use `last_version` instead of `versions` when possible. Fixes #1087.
2016-02-21 22:51:40 +01:00
Jean Hominal 91833dd72e Use last_version instead of versions when possible. Fixes #1087.
Use Gollum::Page#last_version instead of Gollum::Page#versions in the
cases identified in #1087:
 * In Precious::App#show_page_or_file
 * In Precious::Views::Page#author
 * In Precious::Views::Page#date
2016-02-14 23:15:38 +01:00
Bart Kamphorst c049f7c11f Merge pull request #1106 from gollum/youtube_demo_vids
Adds links to youtube videos in README.
2016-01-14 17:01:28 +01:00
Bart Kamphorst 6bd2f3bff5 Drop 1.9.3 testing on Travis, add 2.3.0. 2016-01-10 15:28:23 +01:00
Bart Kamphorst 8c3c519679 Adds links to youtube videos in README. 2016-01-10 11:49:34 +01:00
Dawa Ometto 4e5002a31e Merge pull request #1098 from andrehjr/gh-1066-sanitize-basepath
Sanitize basepath options when adding with more than one / at the start Fixes #1066.
2015-12-30 18:39:30 +01:00
André Luis Leal Cardoso Junior 5a53c58b04 Sanitize basepath options when adding with more than one / at the start. Fixes #1066 2015-12-05 23:23:22 -02:00
Bart Kamphorst a61d1e3d10 Merge pull request #1094 from repotag/master
Update kramdown and useragent dependencies.
2015-11-30 11:26:51 +01:00
Bart Kamphorst 1a50f99189 Merge branch 'master' of https://github.com/gollum/gollum 2015-11-30 00:28:30 +01:00
Bart Kamphorst 6caacbf388 Update kramdown and useragent dependencies. 2015-11-30 00:28:01 +01:00
Dawa Ometto f876aa7d0f Merge pull request #1077 from mpnowacki/renaming
fixed file renaming issues with page_file_dir
2015-11-02 11:42:50 +01:00
Dawa Ometto 31e1281600 Merge pull request #1086 from ngyuki/fix-preview-sidebar
Fix position of sidebar in preview
2015-11-02 11:42:25 +01:00
ngyuki 90072a9332 Fix position of sidebar in preview 2015-11-02 12:45:30 +09:00
Dawa Ometto bacd2893b9 Merge pull request #1084 from SkyCrawl/master
Fixing the vague "running from source" description in README
2015-10-25 13:20:17 +01:00
SkyCrawl 7362fd859b Fixing the "running" section 2015-10-25 13:12:36 +01:00
mpnowacki 3811fb46b3 fixed file renaming issues with page_file_dir. This will only work with appropriate changes in gollum-lib 2015-10-04 11:34:25 +02:00
Dawa Ometto 9cc02982be Merge pull request #973 from hsanson/add-plantuml-opt
Add option to configure PlantUML endpoint
2015-08-09 19:15:02 +02:00
Horacio Sanson 1cceb7d4b4 Add option to configure PlantUML endpoint 2015-02-05 01:10:12 +09:00
16 changed files with 241 additions and 98 deletions
+2 -1
View File
@@ -1,9 +1,10 @@
rvm:
- 1.9.3
- 2.0.0
- 2.1.0
- 2.1.1
- 2.2.2
- 2.3.0
- 2.4.0
- jruby-19mode
before_install:
- sudo apt-get update
+91
View File
@@ -0,0 +1,91 @@
# Contributing to Gollum
Thanks for your interest in the gollum project!
## Submitting an Issue
Please note that the issue tracker is meant for:
1. Bug reports.
2. Feature requests.
If your have problems using or installing the software which stem from bugs in the software or a lack of documentation, we are always happy to help out! However, **for ordinary usage questions, please consider asking elsewhere**, for instance on [StackOverflow](http://stackoverflow.com/questions/tagged/gollum-wiki).
Gollum supports [custom macros](https://github.com/gollum/gollum/wiki#macros) for the creation of additional wiki markup tags. Please **do not** use this tracker to request macros specific to your situation. However, if you have or are working on a macro that you think may be useful to more users, you can share it as a GitHub [gist](https://gist.github.com) and link to it in the [wiki](https://github.com/gollum/gollum/wiki/Custom-macros).
Before submitting an issue, **please carefully look through the following places** to make sure your problem is not already addressed:
1. The issue tracker.
1. The [README](https://github.com/gollum/gollum/blob/master/README.md).
1. The project's [wiki](https://github.com/gollum/gollum/wiki).
Lastly, please **consider helping out** by opening a Pull Request!
## Opening a Pull Request
Pull Requests fixing bugs, implementing new features, or updating documentation and dependencies are all very welcome! If you would like to help out with the project, you can pick an open issue from the issue tracker. We're more than happy to help you get started! Here's how you can proceed:
1. Fork and clone Gollum.
2. Create a thoughtfully named topic branch to contain your changes.
3. If you haven't installed dependencies yet, navigate to your clone and execute:
```
[sudo] bundle install
```
4. Hack away.
5. Add your own tests and make sure they're all still passing.
6. If some of your changes deserve a mention on Gollum's home page, edit the README accordingly.
7. If necessary, rebase your commits into logical chunks, without errors.
8. Push the branch to your fork on GitHub.
9. Create a pull request for Gollum.
**Notes:**
* Do not change Gollum's version numbers, we will do that on our own.
### Running tests
1. Install [Bundler](http://bundler.io/).
2. Navigate to the cloned source of Gollum.
3. Install dependencies:
```
[sudo] bundle install
```
4. Run the tests:
```
bundle exec rake test
```
### Working with test repositories
An example of how to add a test file to the bare repository lotr.git.
```
mkdir tmp
cd tmp
git clone ../lotr.git/
git log
echo "test" > test.md
git add .
git commit -am "Add test"
git push ../lotr.git/ master
```
## Releasing the gem
Gollum uses [Semantic Versioning](http://semver.org/).
x.y.z
For z releases:
```
rake bump
rake release
```
For x.y releases:
```
# First update VERSION in lib/gollum.rb and then:
rake gemspec
rake release
```
+6
View File
@@ -1,3 +1,9 @@
# 4.1.0 /2016-03-09
* Added file deletion functionality to file view
* Various performance improvements
* Emoji support
# 4.0.0 /2015-04-11
* Now compatible with JRuby (via the [rjgit](https://github.com/repotag/rjgit) [adapter](https://github.com/repotag/gollum-lib_rjgit_adapter))
+18 -76
View File
@@ -23,9 +23,15 @@ For more information on Gollum's capabilities and pitfalls:
3. [Troubleshoot guide](https://github.com/gollum/gollum/wiki/Troubleshoot-guide).
4. [Security overview](https://github.com/gollum/gollum/wiki/Security).
### Videos
* [Quick impression of gollum](https://www.youtube.com/watch?v=gj1qqK3Oku8)
* [Gollum overview and simple markdown tutorial (german with english subtitles)](https://www.youtube.com/watch?v=wfWgDRmcbU4)
* [Advanced features in action](https://www.youtube.com/watch?v=EauxgxsLDC4)
## SYSTEM REQUIREMENTS
| Operating System | Ruby | Adapters | Supported |
| Operating System | Ruby | Adapters | Supported |
| ---------------- | -------------- | ------------------ | --------- |
| Unix/Linux-like | Ruby 1.9.3+ | all except [RJGit](https://github.com/repotag/rjgit) | yes |
| Unix/Linux-like | [JRuby](https://github.com/jruby/jruby) (1.9.3+ compatible) | [RJGit](https://github.com/repotag/rjgit) | yes |
@@ -67,7 +73,7 @@ Installation examples for individual systems can be seen [here](https://github.c
```
* And install:
```
[sudo] gem install --no-ri --no-rdoc pkg/gollum*.gem
[sudo] gem install --no-document pkg/gollum*.gem
```
### Markups
@@ -79,7 +85,6 @@ Gollum presently ships with support for the following markups:
Since all markups are rendered by the [github-markup](https://github.com/github/markup) gem, you can easily add support for other markups by additional installation:
* [AsciiDoc](http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/) -- `[sudo] gem install asciidoctor`
* [Creole](http://www.wikicreole.org/wiki/CheatSheet) -- `[sudo] gem install creole`
* [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown) -- `[sudo] gem install github-markdown`
* [MediaWiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `[sudo] gem install wikicloth`
* [Org](http://orgmode.org/worg/dev/org-syntax.html) -- `[sudo] gem install org-ruby`
* [Pod](http://perldoc.perl.org/perlpod.html) -- requires Perl >= 5.10 (the `perl` command must be available on your command line)
@@ -98,14 +103,17 @@ Simply:
2. Run: `gollum`.
3. Open `http://localhost:4567` in your browser.
If you wish to run from source, simply:
1. Navigate to your git repository (wiki) via the command line.
2. Run: `bundle exec bin/gollum`
3. Open `http://localhost:4567` in your browser.
This will start up a web server (WEBrick) running Gollum with a web interface, where you can view and edit your wiki.
### Running from source
1. `git clone https://github.com/gollum/gollum`
2. `cd gollum`
3. `[sudo] bundle install` (may not always be necessary).
4. `bundle exec bin/gollum`
* Like that, gollum assumes the target wiki (git repository) is the project repository itself. If it's not, execute `bundle exec bin/gollum <path-to-wiki>` instead.
5. Open `http://localhost:4567` in your browser.
### Rack
Gollum can also be ran with any [rack-compatible web server](https://github.com/rack/rack#supported-web-servers). More on that [over here](https://github.com/gollum/gollum/wiki/Gollum-via-Rack).
@@ -138,6 +146,7 @@ Gollum comes with the following command line options:
| --page-file-dir | [PATH] | Specify the subdirectory for all pages. If set, Gollum will only serve pages from this directory and its subdirectories. Default: repository root. |
| --css | none | Tell Gollum to inject custom CSS into each page. Uses `custom.css` from repository root.<sup>3,5</sup> |
| --js | none | Tell Gollum to inject custom JS into each page. Uses `custom.js` from repository root.<sup>3,5</sup> |
| --emoji | none | Parse and interpret emoji tags (e.g. :heart:). |
| --no-edit | none | Disable the feature of editing pages. |
| --live-preview | none | Enable the live preview feature in page editor. |
| --no-live-preview | none | Disable the live preview feature in page editor. |
@@ -166,70 +175,3 @@ Gollum comes with the following command line options:
When `--config` option is used, certain inner parts of Gollum can be customized. This is used throughout our wiki for certain user-level alterations, among which [customizing supported markups](https://github.com/gollum/gollum/wiki/Formats-and-extensions) will probably stand out.
**All of the mentioned alterations work both for Gollum's config file (`config.rb`) and Rack's config file (`config.ru`).**
## HOW TO CONTRIBUTE
1. Fork and clone Gollum.
2. Create a thoughtfully named topic branch to contain your changes.
3. If you haven't installed dependencies yet, navigate to your clone and execute:
```
[sudo] bundle install
```
4. Hack away.
5. Add your own tests and make sure they're all still passing.
6. If some of your changes deserve a mention on Gollum's home page, edit the README accordingly.
7. If necessary, rebase your commits into logical chunks, without errors.
8. Push the branch to your fork on GitHub.
9. Create a pull request for Gollum.
**Notes:**
* Do not change Gollum's version numbers, we will do that on our own.
### Running tests
1. Install [Bundler](http://bundler.io/).
2. Navigate to the cloned source of Gollum.
3. Install dependencies:
```
[sudo] bundle install
```
4. Run the tests:
```
bundle exec rake test
```
### Working with test repositories
An example of how to add a test file to the bare repository lotr.git.
```
mkdir tmp
cd tmp
git clone ../lotr.git/
git log
echo "test" > test.md
git add .
git commit -am "Add test"
git push ../lotr.git/ master
```
## RELEASING
Gollum uses [Semantic Versioning](http://semver.org/).
x.y.z
For z releases:
```
rake bump
rake release
```
For x.y releases:
```
# First update VERSION in lib/gollum.rb and then:
rake gemspec
rake release
```
+21 -5
View File
@@ -71,10 +71,8 @@ opts = OptionParser.new do |opts|
"Example: setting this to '/wiki' will make the wiki accessible under 'http://localhost:4567/wiki/'.") do |base_path|
# first trim a leading slash, if any
if base_path.start_with?("/")
base_path = base_path[1..-1]
end
base_path.sub!(/^\/+/, '')
# make a backup of the option and sanitize it
base_path_original = base_path.dup
base_path = CGI.escape(base_path)
@@ -101,6 +99,9 @@ MSG
opts.on("--js", "Inject custom JavaScript into each page. The '<git-repo>/custom.js' file is used (must be committed).") do
wiki_options[:js] = true
end
opts.on("--emoji", "Parse and interpret emoji tags (e.g. :heart:).") do
wiki_options[:emoji] = true
end
opts.on("--no-edit", "Disable the feature of editing pages.") do
wiki_options[:allow_editing] = false
end
@@ -144,6 +145,9 @@ MSG
"If not specified, uses the '<git-repo>/mathjax.config.js' file.") do |file|
wiki_options[:mathjax_config] = file || 'mathjax.config.js'
end
opts.on("--plantuml-url [URL]", "Sets the PlantUML server endpoint.") do |url|
wiki_options[:plantuml_url] = url
end
opts.on("--template-dir [PATH]", "Specify custom mustache template directory.") do |path|
wiki_options[:template_dir] = path
end
@@ -161,7 +165,6 @@ MSG
end
opts.separator ""
end
# Read command line options into `options` hash
@@ -207,6 +210,12 @@ if options[:irb]
if !wiki.exist? then
raise Gollum::InvalidGitRepositoryError
end
if wiki_options[:plantuml_url]
Gollum::Filter::PlantUML.configure do |config|
puts "Using #{wiki_options[:plantuml_url]} as PlantUML endpoint"
config.url = wiki_options[:plantuml_url]
end
end
puts
puts "Loaded Gollum wiki at:"
puts "#{File.expand_path(gollum_path).inspect}"
@@ -242,6 +251,13 @@ else
require cfg
end
if wiki_options[:plantuml_url]
Gollum::Filter::PlantUML.configure do |config|
puts "Using #{wiki_options[:plantuml_url]} as PlantUML endpoint"
config.url = wiki_options[:plantuml_url]
end
end
base_path = wiki_options[:base_path]
if base_path.nil?
+8 -5
View File
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 1.9'
s.name = 'gollum'
s.version = '4.0.1'
s.date = '2015-09-20'
s.version = '4.1.0'
s.date = '2017-03-09'
s.rubyforge_project = 'gollum'
s.license = 'MIT'
@@ -25,21 +25,23 @@ Gem::Specification.new do |s|
s.extra_rdoc_files = %w[README.md LICENSE]
s.add_dependency 'gollum-lib', '~> 4.0', '>= 4.0.1'
s.add_dependency 'kramdown', '~> 1.8.0'
s.add_dependency 'kramdown', '~> 1.9.0'
s.add_dependency 'sinatra', '~> 1.4', '>= 1.4.4'
s.add_dependency 'mustache', ['>= 0.99.5', '< 1.0.0']
s.add_dependency 'useragent', '~> 0.14.0'
s.add_dependency 'useragent', '~> 0.16.2'
s.add_dependency 'gemojione', '~> 2'
s.add_development_dependency 'rack-test', '~> 0.6.2'
s.add_development_dependency 'shoulda', '~> 3.5.0'
s.add_development_dependency 'minitest-reporters', '~> 0.14.16'
s.add_development_dependency 'twitter_cldr', '~> 3.2.0'
s.add_development_dependency 'mocha', '~> 1.1.0'
s.add_development_dependency 'test-unit', '~> 3.1.0' if RUBY_VERSION =~ /^2.2/
s.add_development_dependency 'test-unit', '~> 3.1.0'
s.add_development_dependency 'webrick', '~> 1.3.1'
# = MANIFEST =
s.files = %w[
CONTRIBUTING.md
Gemfile
HISTORY.md
LICENSE
@@ -73,6 +75,7 @@ Gem::Specification.new do |s|
lib/gollum/public/gollum/images/fileview/folder-horizontal.png
lib/gollum/public/gollum/images/fileview/toggle-small-expand.png
lib/gollum/public/gollum/images/fileview/toggle-small.png
lib/gollum/public/gollum/images/fileview/trashcan.png
lib/gollum/public/gollum/images/icon-sprite.png
lib/gollum/public/gollum/images/man_24.png
lib/gollum/public/gollum/images/para.png
+1 -1
View File
@@ -16,7 +16,7 @@ require File.expand_path('../gollum/uri_encode_component', __FILE__)
$KCODE = 'U' if RUBY_VERSION[0, 3] == '1.8'
module Gollum
VERSION = '4.0.1'
VERSION = '4.1.0'
def self.assets_path
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
+38 -4
View File
@@ -49,7 +49,7 @@ module Precious
class App < Sinatra::Base
register Mustache::Sinatra
include Precious::Helpers
dir = File.dirname(File.expand_path(__FILE__))
# Detect unsupported browsers.
@@ -59,6 +59,7 @@ module Precious
Browser.new('Internet Explorer', '10.0'),
Browser.new('Chrome', '7.0'),
Browser.new('Firefox', '4.0'),
Browser.new('Safari', '9.0')
]
def supported_useragent?(user_agent)
@@ -95,7 +96,6 @@ module Precious
before do
settings.wiki_options[:allow_editing] = settings.wiki_options.fetch(:allow_editing, true)
@allow_editing = settings.wiki_options[:allow_editing]
forbid unless @allow_editing || request.request_method == "GET"
Precious::App.set(:mustache, {:templates => settings.wiki_options[:template_dir]}) if settings.wiki_options[:template_dir]
@base_url = url('/', false).chomp('/')
@page_dir = settings.wiki_options[:page_file_dir].to_s
@@ -130,6 +130,14 @@ module Precious
Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
end
get '/emoji/:name' do
begin
[200, {'Content-Type' => 'image/png'}, emoji(params['name'])]
rescue ArgumentError
not_found
end
end
get '/data/*' do
if page = wiki_page(params[:splat].first).page
page.raw_data
@@ -164,6 +172,8 @@ module Precious
end
post '/uploadFile' do
forbid unless @allow_editing
wiki = wiki_new
unless wiki.allow_uploads
@@ -179,7 +189,7 @@ module Precious
halt 500 unless tempfile.is_a? Tempfile
# Remove page file dir prefix from upload path if necessary -- committer handles this itself
dir = wiki.per_page_uploads ? params[:upload_dest].match(/^(#{wiki.page_file_dir}\/+)?(.*)/)[2] : 'uploads'
dir = wiki.per_page_uploads ? params[:upload_dest] : ::File.join([wiki.page_file_dir, 'uploads'].compact)
ext = ::File.extname(fullname)
format = ext.split('.').last || 'txt'
filename = ::File.basename(fullname, ext)
@@ -212,7 +222,22 @@ module Precious
end
end
post '/deleteFile/*' do
forbid unless @allow_editing
wiki = wiki_new
filepath = params[:splat].first
unless filepath.nil?
commit = commit_message
commit[:message] = "Deleted #{filepath}"
wiki.delete_file(filepath, commit)
end
redirect to('/fileview')
end
post '/rename/*' do
forbid unless @allow_editing
wikip = wiki_page(params[:splat].first)
halt 500 if wikip.nil?
wiki = wikip.wiki
@@ -249,6 +274,8 @@ module Precious
end
post '/edit/*' do
forbid unless @allow_editing
path = '/' + clean_url(sanitize_empty_params(params[:path])).to_s
page_name = CGI.unescape(params[:page])
wiki = wiki_new
@@ -308,6 +335,8 @@ module Precious
end
post '/create' do
forbid unless @allow_editing
name = params[:page].to_url
path = sanitize_empty_params(params[:path]) || ''
format = params[:format].intern
@@ -327,6 +356,8 @@ module Precious
end
post '/revert/*/:sha1/:sha2' do
forbid unless @allow_editing
wikip = wiki_page(params[:splat].first)
@path = wikip.path
@name = wikip.name
@@ -350,6 +381,8 @@ module Precious
end
post '/preview' do
forbid unless @allow_editing
wiki = wiki_new
@name = params[:page] || "Preview"
@page = wiki.preview_page(@name, params[:content], params[:format])
@@ -358,6 +391,7 @@ module Precious
@mathjax = wiki.mathjax
@h1_title = wiki.h1_title
@editable = false
@bar_side = wiki.bar_side
@allow_uploads = wiki.allow_uploads
mustache :page
end
@@ -495,7 +529,7 @@ module Precious
# Extensions and layout data
@editable = true
@page_exists = !page.versions.empty?
@page_exists = !page.last_version.nil?
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
@h1_title = wiki.h1_title
+13
View File
@@ -1,6 +1,11 @@
# ~*~ encoding: utf-8 ~*~
require 'gemojione'
module Precious
module Helpers
EMOJI_PATHNAME = Pathname.new(Gemojione.index.images_path).freeze
# Extract the path string that Gollum::Wiki expects
def extract_path(file_path)
return nil if file_path.nil?
@@ -51,5 +56,13 @@ module Precious
return mustache :error
end
def emoji(name)
if emoji = Gemojione.index.find_by_name(name)
IO.read(EMOJI_PATHNAME.join("#{emoji['unicode']}.png"))
else
fail ArgumentError, "emoji `#{name}' not found"
end
end
end
end
+16 -1
View File
@@ -85,6 +85,22 @@ ol.tree
margin-right: 7px;
vertical-align: text-top;
}
li.file form
{
vertical-align:middle;
display: inline-block;
}
li.file form button
{
vertical-align:middle;
height: 20px;
padding-left: 36px;
padding-right: 10px;
border: 0px solid #000000;
background: url("../images/fileview/trashcan.png") no-repeat 16px center;
cursor: pointer;
}
}
li.file a[href *= '.pdf'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href *= '.html'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href $= '.css'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
@@ -125,4 +141,3 @@ ol.tree
}
li input:checked + ol > li { display: block; margin: 0 0 0.125em; /* 2px */}
li input:checked + ol > li:last-child { margin: 0 0 0.063em; /* 1px */ }
+6
View File
@@ -849,3 +849,9 @@ ul.actions {
.clearfloats {
clear: both;
}
.emoji {
width: 20px;
height: 20px;
vertical-align: -18%;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -211,6 +211,11 @@ var MarkDownHelp = [
{
menuName: 'Escaping',
data: '<p>If you want to use a special Markdown character in your document (such as displaying literal asterisks), you can escape the character with the backslash (<code>\\</code>). Markdown will ignore the character directly after a backslash.'
},
{
menuName: 'Emoji',
data: '<p>See the <a href="http://emojione.com/demo/" target="_blank">EmojiOne demo</a> for all available emoji. To include one, wrap the emoji name in colons and use underscores instead of spaces (e.g. :heart: or :point_up:).'
}
]
}
+2 -4
View File
@@ -22,15 +22,13 @@ module Precious
end
def author
page_versions = @page.versions
first = page_versions ? page_versions.first : false
first = page.last_version
return DEFAULT_AUTHOR unless first
first.author.name.respond_to?(:force_encoding) ? first.author.name.force_encoding('UTF-8') : first.author.name
end
def date
page_versions = @page.versions
first = page_versions ? page_versions.first : false
first = page.last_version
return Time.now.strftime(DATE_FORMAT) unless first
first.authored_date.strftime(DATE_FORMAT)
end
+2 -1
View File
@@ -36,7 +36,8 @@ module Precious
# 1012: Folders and Pages need to be separated
@results.each do |page|
page_path = page.path.sub(/^#{@path}\//, '')
page_path = page.path
page_path = page_path.sub(/^#{Regexp.escape(@path)}\//, '') unless @path.nil?
if page_path.include?('/')
folder = page_path.split('/').first
+12
View File
@@ -707,6 +707,18 @@ context "Frontend with lotr" do
assert_match /not so big smelly creatures/, last_response.body
end
test "existing emoji" do
get "/emoji/heart"
assert_equal 200, last_response.status
assert_equal 'image/png', last_response.headers['Content-Type']
assert_equal [137, 80, 78, 71, 13, 10, 26, 10], last_response.body.each_byte.to_a[0..7]
end
test "missing emoji" do
get "/emoji/oggy_was_here"
assert_equal 404, last_response.status
end
def app
Precious::App
end