Document how to escape emoji

This commit is contained in:
Sven Schwyn
2017-04-30 15:54:55 +02:00
parent 97fab1df14
commit f41a85ced9
2 changed files with 21 additions and 21 deletions
+1 -1
View File
@@ -142,7 +142,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:). |
| --emoji | none | Parse and interpret emoji tags (e.g. `:heart:`) unless when the leading colon is backslashed (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. |
+20 -20
View File
@@ -21,28 +21,28 @@ wiki_options = {
opts = OptionParser.new do |opts|
# define program name (although this defaults to the name of the file, just in case...)
opts.program_name = "gollum"
# set basic info for the "--help" command (options will be appended automatically from the below definitions)
opts.banner = '
Gollum is a multi-format Wiki Engine/API/Frontend.
Usage:
gollum [options] [git-repo]
Arguments:
[git-repo] Path to the git repository being served. If not specified, current working directory is used.
Notes:
Paths for all options are relative to <git-repo> unless absolute.
This message is only a basic description. For more information, please visit:
https://github.com/gollum/gollum
OPTIONS'
# define gollum options
# define gollum options
opts.separator ""
opts.separator " Major:"
opts.on("-h", "--host [HOST]", "Specify the hostname or IP address to listen on. Default: '0.0.0.0'.") do |host|
options[:bind] = host
end
@@ -69,14 +69,14 @@ opts = OptionParser.new do |opts|
end
opts.on("-b", "--base-path [PATH]", "Specify the leading portion of all Gollum URLs (path info). Default: '/'.",
"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
base_path.sub!(/^\/+/, '')
# make a backup of the option and sanitize it
base_path_original = base_path.dup
base_path = CGI.escape(base_path)
# then let the user know if we changed the URL
unless base_path_original == base_path
puts <<MSG
@@ -85,11 +85,11 @@ Warning: your base-path has been sanitized:
- sanitized: '#{base_path}'
MSG
end
# and finally, let others enjoy our hard work:
wiki_options[:base_path] = base_path
end
opts.on("--page-file-dir [PATH]", "Specify the subdirectory for all pages. Default: repository root.",
opts.on("--page-file-dir [PATH]", "Specify the subdirectory for all pages. Default: repository root.",
"Example: setting this to 'pages' will make Gollum serve only pages at '<git-repo>/pages/*'.") do |path|
wiki_options[:page_file_dir] = path
end
@@ -99,7 +99,7 @@ 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
opts.on("--emoji", "Parse and interpret emoji tags (e.g. :heart:) unless when the leading colon is backslashed (e.g. \\:heart:).") do
wiki_options[:emoji] = true
end
opts.on("--no-edit", "Disable the feature of editing pages.") do
@@ -124,10 +124,10 @@ MSG
opts.on("--irb", "Launch Gollum in 'console mode', with a predefined API.") do
options[:irb] = true
end
opts.separator ""
opts.separator " Minor:"
opts.on("--h1-title", "Use the first '<h1>' as page title.") do
wiki_options[:h1_title] = true
end
@@ -156,7 +156,7 @@ MSG
end
opts.separator ""
opts.separator " Common:"
opts.on("--help", "Display this message.") do
puts opts
exit 0
@@ -165,7 +165,7 @@ MSG
puts "Gollum " + Gollum::VERSION
exit 0
end
opts.separator ""
end
@@ -258,7 +258,7 @@ else
class MapGollum
def initialize(base_path)
@mg = Rack::Builder.new do
map "/#{base_path}" do
run Precious::App
end
@@ -268,7 +268,7 @@ else
map '/*' do
run Proc.new { [302, { 'Location' => "/#{base_path}" }, []] }
end
end
end
@@ -276,7 +276,7 @@ else
@mg.call(env)
end
end
# Rack::Handler does not work with Ctrl + C. Use Rack::Server instead.
Rack::Server.new(:app => MapGollum.new(base_path), :Port => options[:port], :Host => options[:bind]).start
end