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