From f41a85ced9b2707d725bd2db9e3f2c27be918d71 Mon Sep 17 00:00:00 2001 From: Sven Schwyn Date: Sun, 30 Apr 2017 15:54:55 +0200 Subject: [PATCH] Document how to escape emoji --- README.md | 2 +- bin/gollum | 40 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 27fec06f..4001d172 100644 --- a/README.md +++ b/README.md @@ -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.3,5 | | --js | none | Tell Gollum to inject custom JS into each page. Uses `custom.js` from repository root.3,5 | -| --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. | diff --git a/bin/gollum b/bin/gollum index 5ec045f5..817ea602 100755 --- a/bin/gollum +++ b/bin/gollum @@ -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 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 </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 '/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 '

' 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